This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Only copy nodes that have text at some point in the tree


Matt,
<xsl:template match="Product">
	<xsl:if test="descendant::*/text()">
		<xsl:copy-of select="." />
	</xsl:if>
</xsl:template>

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com 
> [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of 
> mjyoungblut@mmm.com
> Sent: 28 September 2001 21:55
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] Only copy nodes that have text at some point 
> in the tree
> 
> 
> Hi,
>      I know I have seen this question posed before, but I 
> can't seem to find it in the FAQ or in the archives.  Sorry 
> for the redundancy.
> 
> I only want to copy nodes that have a textual descendant. <Catalog>
>      <Product NodeID="A" Action="A">
>           <Child>
>                <Grandchild/>
>           </Child>
>      </Product>
>      <Product NodeID="B" Action="A">
>           <Child>
>                <Grandchild>Steven</Grandchild>
>           </Child>
>      </Product>
>      <Product NodeID="C" Action="A">
>           <Child>
>                <Grandchild>Paul</Grandchild>
>                <Grandchild/>
>           </Child>
>      </Product>
>      <Product NodeID="D" Action="A"/>
> 
> </Catalog>
> 
> I would expect the results to look like the following: <Catalog>
>      <Product NodeID="B" Action="A">
>           <Child>
>                <Grandchild>Steven</Grandchild>
>           </Child>
>      </Product>
>      <Product NodeID="C" Action="A">
>           <Child>
>                <Grandchild>Paul</Grandchild>
>           </Child>
>      </Product>
> </Catalog>
> 
> If somebody has a link or a solution to this problem, I would 
> appreciate it. Thanks,
>      Matt Youngblut
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]