|
Subject: RE: [xsl] Only copy nodes that have text at some point in the tree From: mjyoungblut@xxxxxxx Date: Fri, 28 Sep 2001 16:52:11 -0500 |
This takes care of all of the product nodes, but what about the
<Grandchild> node for <Product NodeID='C'>? This should also be removed.
Is there a recursive way of solving this problem?
Thanks,
Matt
"Chris Bayes"
<chris@xxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
.uk> cc: (bcc: Matthew J. Youngblut/US-Corporate/3M/US)
Subject: RE: [xsl] Only copy nodes that have text at some point in
09/28/2001 the tree
04:19 PM
Please respond
to xsl-list
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@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> mjyoungblut@xxxxxxx
> Sent: 28 September 2001 21:55
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> 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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Only copy nodes that have, Chris Bayes | Thread | Re: [xsl] Only copy nodes that have, Thomas B. Passin |
| [xsl] need position() of second doc, ken . dickerson | Date | Re: [xsl] Newbie question - transfo, Thomas B. Passin |
| Month |