[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Can someone explain this generate-id and key xsl fragment to me?


Subject: [xsl] Can someone explain this generate-id and key xsl fragment to me?
From: russurquhart1@xxxxxxxxxxx
Date: Fri, 28 Feb 2014 12:17:59 -0600 (CST)

 Hi,

I'm having to manage an xslt that someone else wrote, that generally works correctly, but when it doesn't i have problems.

In one template that is a for-each command that is executed. The line is:

<xsl:for-each select="//errata_section[generate-id(.)=generate-id(key('module-index', module_impacted)[1])]">
 <xsl:sort select="module_impacted"/>

The xml it is processing are bugs of a form:

<errata_section>
.
. bug info.
.
<module_impacted>DSS</module_impacted>
<module_impacted>VPE</module_impacted>
<module_impacted>VIP</module_impacted>

</errata_section>

And there are hundreds of errata_section elements, each with a module_impacted element(s) reflecting, for the specific errata_section, those modules it impacts. There must be at least one module_impacted element per errata_section, but, as in the example above, there may be more. 

The above line, is supposed to sort, and process each module_impacted element, outputting tables based on the value of the module_impacted element.

What i am seeing is, and i can't determine what is causing this, is certain module_impacted elements don't seem to get selected and processed. When the final output is generated some are missing altogether. For the example above, the above line should process, in due course, DSS, then later down the road, VIP, and then VPE. What i'm seeing in the debugger, is VIP and VPE not getting picked up or processed at all.

To complicate matters, when i use Stylus Studio to debug, using Saxon as the internal debugger, i get a different result than if i use libxslt. Both give incorrect output, but some are less incorrect than others. (The libxslt, seems to find VPE, but not VIP, but that is handled incorrectly as well.)

I guess if someone could help me to understand what the fragment is doing, maybe that would help me to better dubg this!

Thanks for any help!

Russ


Current Thread
Keywords