Subject: Re: [xsl] apply-templates repeats inside xsl:for-each, why From: "Syd Bauman s.bauman@xxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 16 Jun 2014 01:46:19 -0000 |
Ummm .. maybe I'm missing something, but isn't that exactly the same as <xsl:apply-templates select="$root/map/concept/concept[ @id = $platforms/platform/@id ]"/> ? (I'm too tired right now to explain this well, and many on this list are much better than I at explaining such things, but basically that says "select each /map/concept/concept that has an id= that is the same as the id= of one of the $platforms/platform elements, and apply templates to it". That is the "/map/concept/concept" grabs all of the <concept> elements that are children of a <concept> that are in turn children of the <map>, and the predicate selects only those that meet the condition. But the '=' comparison operator works on sequences, and the condition returns true for all 3.) > I fixed it for my purposes by doing it this way: > > <xsl:variable name="num" > select="count($platforms/platform)"/> <xsl:for-each > select="1 to $num"> > <xsl:variable name="n" select="position()"/> > <xsl:apply-templates select="$root/map/concept/concept[@id > = > $platforms/platform[$n]/@id]"/> > </xsl:for-each> > > Then I get the output just once like this: > > Windows XP > Windows Vista > Windows 7 > > Thanks for the help in breaking some adhesions.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] apply-templates repeats i, Mark Giffin m1879@xx | Thread | Re: [xsl] apply-templates repeats i, Dimitre Novatchev dn |
Re: [xsl] apply-templates repeats i, Mark Giffin m1879@xx | Date | Re: [xsl] apply-templates repeats i, Dimitre Novatchev dn |
Month |