Subject: Re: xsl:variable From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 10 May 2000 17:12:13 +0100 (BST) |
> After when we reach the pb element, I print the > content of this global variable. I empty the content > of the variable, and again back to the first step. You can't do that as XSL variables do not change their values once bound. I have already posted the solution to the problem that you originally posed (selecting as far as the first element) but you just changed the problem to selecting things between multiple pb elements In which case you want something like <div type="chapter"> 1<!-- Other tags --> <pb/> 2<!-- Other tags --> <pb/> 3<!-- Other tags --> <pb/> 4<!-- Other tags --> <pb/> 5 </div> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > <xsl:output method="xml" indent="yes"/> <xsl:template match="div[@type='chapter']"> <xxxx> <xsl:apply-templates select="node()[not(preceding-sibling::pb)]"/> </xxxx> <xsl:for-each select="pb"> <xxxx> <xsl:variable name="x" select="1+count(preceding-sibling::pb)"/> <xsl:apply-templates select="following-sibling::node()[count(preceding-sibling::pb)=$x]"/> </xxxx> </xsl:for-each> </xsl:template> </xsl:stylesheet> bash-2.01$ xt div.xml div.xsl <?xml version="1.0" encoding="utf-8"?> <xxxx> 1 </xxxx> <xxxx> 2 </xxxx> <xxxx> 3 </xxxx> <xxxx> 4 </xxxx> <xxxx> 5 </xxxx> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: xsl:variable, Sydney | Thread | RE: xsl:variable, Kay Michael |
Re: newbie How to use "xsl:counter", Wendell Piez | Date | Has anyone got examples of these va, Dylan Walsh |
Month |