[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: apply-templates repeats inside xsl:for-each, why

Subject: Re: 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
Re:  apply-templates repeats inside xsl:for-each
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.