[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Different conditional outputs in same Stylesheet o
Pankaj Chaturvedi schrieb:
[...] <xsl:template match="article/meta/journalcode"> <xsl:if test="string(.)='CEDE'"> You can simplify this to: ". = 'CEDE'" <xsl:copy> <xsl:apply-templates mode="CEDE"/> </xsl:copy> </xsl:if> </xsl:template>
<xsl:apply-templates select="node()" mode="CEDE"/> This means: process all child nodes of the context node. 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>. Take a look back at the example I gave earlier in this thread. <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 Michael
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|