Subject: Re: [xsl] How to prevent copying non-existing elements? From: Florent Georges <lists@xxxxxxxxxxxx> Date: Tue, 4 Aug 2009 13:20:40 +0000 (GMT) |
Ben Stover wrote: > In pseudo code I need something like > <xsl:template match="/"> > .... > "if /moxx:aaa/moxx:bbb exists" then ( > <moxx:someelement> > <xsl:value-of select="/moxx:aaa/moxx:bbb"/> > </moxx:someelement>) > .... > How can I code this in XSLT ? In addition to Mike's answer, the following is maybe more idiomatic, but that's hard to tell from the snippet of code you provided: <xsl:template match="/"> .... <xsl:apply-templates select="moxx:aaa/moxx:bbb"/> .... </xsl:template> <xsl:template match="moxx:bbb"> <moxx:someelement> <!-- or copy-of @*|node() ? --> <xsl:value-of select="."/> </moxx:someelement>) </xsl:template> Regards, -- Florent Georges http://www.fgeorges.org/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to prevent copying no, Michael Ludwig | Thread | [xsl] Getting sibling nodes from un, Mike Ferrari |
Re: [xsl] How to prevent copying no, Michael Ludwig | Date | RE: [xsl] How to prevent copying no, Wendell Piez |
Month |