Subject: Re: [xsl] XPath expression confusion From: Geert Josten <Geert.Josten@xxxxxxxxxxx> Date: Thu, 12 Jan 2006 23:51:19 +0100 |
<xsl:for-each select="$all-reqs"> <xsl:variable name="number" select="." /> <xsl:choose> <xsl:when test="/system/components/component/requirement[@number = $number]" /> <xsl:otherwise> <requirement><xsl:copy-of select="." /></requirement> </xsl:otherwise> </xsl:choose> </xsl:for-each>
Cheers, Geert
<xsl:variable name="all-reqs" select="document('requirements.xml')/requirements//requirement/number" />
<xsl:template match="/"> <un-assigned-reqs> <xsl:for-each select="$all-reqs"> <xsl:choose> <xsl:when test="/system/components/component/requirement/@number = ." /> <xsl:otherwise> <requirement><xsl:value-of select="." /></requirement> </xsl:otherwise> </xsl:choose> </xsl:for-each> </un-assigned-reqs> </xsl:template>
It was my belief that the XPath expression in the test would search all the number attribute values in the document for a value that matched the value of the current iteration of the loop. Instead, it seems that there are no matches, as I get one element output for each iteration of the loop.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XPath expression confusion, cknell | Thread | Re: [xsl] XPath expression confusio, David Carlisle |
Re: RE: Re: Re: [xsl] Newbie to XSL, Jay Bryant | Date | RE: [xsl] XPath expression confusio, Xia Li |
Month |