Subject: Re: [xsl] merging two documents - only if second document matches From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Sat, 3 Feb 2001 10:54:36 +0000 |
Oliver Becker wrote: > <xsl:template match="/"> > <xsl:for-each select="$idsA[. = $idsB]"> > <xsl:copy-of select="." /> > </xsl:for-each> > </xsl:template> > > The question is, if your input is really as simple as you said. > For example it might be reasonable comparing the normalized string > values like this > normalize-space() = normalize-space($idsB) > inside of the predicate. One of those horrible situations where the behaviour of '=' in XPath turns round and bites you... In the original path: $idsA[. = $idsB] then you're filtering in any nodes in $idsA whose value is the same as *any* of the nodes in $idsB. If you do: $idsA[normalize-space() = normalize-space($idsB)] then the normalize-space($idsB) selects *only the first* of the nodes in $idsB and gives your its normalized value. So you only get any $idsA node that has the same value as the first $idsB. To get round this, you need to work through all the $idsA 'by hand' and put the test in an xsl:if: <xsl:for-each select="$idsA"> <xsl:if test="$idsB[normalize-space() = normalize-space(current())]"> <xsl:copy-of select="." /> </xsl:if> </xsl:for-each> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] merging two documents - o, Oliver Becker | Thread | Re: [xsl] Quasi-Literals and XML, Michael Beddow |
Re: [xsl] Javascript Function with , Jeni Tennison | Date | Re: [xsl] Merging multiple document, Jeni Tennison |
Month |