xsl-list
[Top] [All Lists]

[xsl] apply-templates repeats inside xsl:for-each, why

2014-06-15 19:23:47
I'm running xsl:for-each on a variable $platforms that holds this:

      <platform name="windows_xp" id="unique_2"/>
      <platform name="windows_vista" id="unique_35"/>
      <platform name="windows_7" id="unique_37"/>

The following code produces the same output 3 times for each node in $platforms:

        <xsl:for-each select="$platforms/platform">
<xsl:apply-templates select="$root-of-input-file/map/concept/concept[@id = @id]"/>
        </xsl:for-each>

So in the output I get this kind of thing:

Windows XP
Windows Vista
Windows 7
Windows XP
Windows Vista
Windows 7
Windows XP
Windows Vista
Windows 7

I was expecting to get one output for each element in $platforms. If I use the following outside of xsl:for-each, I get one output:

<xsl:apply-templates select="$root/map/concept/concept[@id = 'unique_2']"/>

What am I missing?

thanks,
Mark
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>