[Home] [By Thread] [By Date] [Recent Entries]
Mathieu Malaterre wrote:
I think you described it fine. My code is just buggy. Here's a solution. But it doesn't "feel" as the correct (i.e., best or xslt-like) solution, it perfectly fits the task: <xsl:template match="row"> <entry ie="{ (entry[1]/para[. != ''] , reverse(preceding-sibling::row/entry[1]/para[. != ''])[1])[1]}" module="{entry[2]/para}" reference="{entry[3]/para}" usage="{entry[4]/para}"/> </xsl:template> It will output the following: <table> <entry ie="Col1 A" module="Col2 A" reference="" usage=""/> <entry ie="Col1 A" module="Col2 B" reference="" usage=""/> <entry ie="Col1 A" module="Col2 C" reference="" usage=""/> <entry ie="Col1 D" module="Col2 D" reference="" usage=""/> <entry ie="Col1 E" module="Col2 E" reference="" usage=""/> <entry ie="Col1 E" module="Col2 F" reference="" usage=""/> <entry ie="Col1 E" module="Col2 G" reference="" usage=""/> </table> That's the problem with document order. Most of the times that does precisely what you want, but sometimes you want it the other way. Hence the reverse() keyword. And I just found out that Saxon (i.e., Java JVM) easily does https. All I did was replacing the previous variable I had with a reference to your document online. Now is this versatile or what! <xsl:variable name="input" select="document('https://gdcm.svn.sourceforge.net/svnroot/gdcm/Sandbox/xslt/dummy.xml')" /> Don't you just love XSLT / XPath! :D Cheers, -- Abel Braaksma
|

Cart



