Subject: Re: [xsl] Different conditional outputs in same Stylesheet or calling another stylesheet (version 1.0, Xalan) From: Michael Ludwig <mlu@xxxxxxxxxxxxx> Date: Fri, 29 Feb 2008 14:37:02 +0100 |
<xsl:template match="article/meta/journalcode"> <xsl:if test="string(.)='CEDE'">
<xsl:copy> <xsl:apply-templates mode="CEDE"/> </xsl:copy> </xsl:if> </xsl:template>
In the absence of a @select, xsl:apply-templates has an implicit @select reading "node()", so what you have is:
In your XML sample, your <ref-book> is not beneath your <journalcode> - it's not a child node of <journalcode>. There is only a text node beneath your <journalcode>.
<xsl:template match="article[ .//journalcode = 'CEDE' ]"> <xsl:comment>CEDE</xsl:comment> <xsl:copy> <xsl:apply-templates mode="CEDE"/> </xsl:copy> </xsl:template>
The processing starts from above the <journalcode>; what I want to get at, is beneath. So, the implicit "node()" works fine here.
If you want to reach back to the <ref-book> from within the <journalcode>, you need to supply a more sporty XPath that climbs back up and then dives down again.
../../references/ref-book # one way ../following-sibling::references/ref-book # another way
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Different conditional out, Pankaj Chaturvedi | Thread | Re: [xsl] Different conditional out, Florent Georges |
Re: [xsl] two-level grouping xslt 2, Martin Honnen | Date | [xsl] XML Schema Design for Effecti, Costello, Roger L. |
Month |