XSLT & grouping

Hi guys,

It looks like the trick to create Muenchian grouping in XSL doesn’t work with Xojo’s transformation.

Factordata[generate-id() = generate-id(key('grp1', ACT_report_grp1)[1])]

My XSLT works fine in Safari, but the Xojo transformation spits out data for every record instead of every unique record. So it appears that either generate-id or the [1] part doesn’t work as expected.

Any thoughts?

It’s probably to do with the node numbering or simply the index as the following test also doesn’t work as expected. Instead of one match it returns all nodes.

<xsl:for-each select="/Parent/Factor/Factordata[count(. | key('grp1', ACT_report_grp1)[1]) = 1]"

Is this a known issue?

A simple index test seems ok though.

<xsl:for-each select="key('mykey','non-unique-value')[1]"> <p> Id: <xsl:value-of select="id"/><br /> Name: <xsl:value-of select="name"/> </p> </xsl:for-each>

Ideas are appreciated…

Turned out Xojo behaved differently when the XML was from file or from the web. As far as I can tell the properties from the XML document objects (ChildCount etc.) are identical in both cases though.

In the end this workaround solved my problem. I now do this with the incoming XML document from the web.

Dim prettyXML As String = xml.Transform(App.kPrettyPrintXSL) xml.LoadXml(prettyXML)

Beats me though.