Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Sort Issue After spawning new nodes Sort Issue After spawning new nodesTo: NULL Date: 9/10/2008 7:22:00 AM
Hello, I have a dataset for which one column has a multivalue (semi-colon
delimited) text field. I have to break this out into unique rows (imagine
this being like an inner join on a look up table) so that the following:
<Row @item1="Label" @item2="aardvark;"/>
<Row @item1="Label" @item2="echidna;zebra;bear;orangutang"/>
<Row @item1="Label" @item2="kangaroo;"/>
becomes:
<Row @item1="Label" @item2="aardvark"/>
<Row @item1="Label" @item2="kangaroo"/>
<Row @item1="Label" @item2="echidna"/>
<Row @item1="Label" @item2="zebra"/>
<Row @item1="Label" @item2="bear"/>
<Row @item1="Label" @item2="orangutang"/>
Ok, so I got this work by calling a named template that recurses the string
using substring-before and substring-after spitting out a variable that
contains artificial nodes:
<xsl:for-each select="row">
<xsl:variable name="breakItUp">
.... call that template that creates the artificial nodes
</xsl:variable>
<xsl:for-each select="node-set(breakItUp)/newItem">
.... write the final row out
</xsl:for-each>
</xsl:for-each>
Since I am looping through the original rows and then as an inner loop,
looping through these, it breaks things out properly in the end result. I'm
leaving details out, and hoping they aren't critical to the real issue which
is...
Now of course, real users want this sorted. I find that I'm running into a
block here. Any chunk of rows that were originally brokent out of the string
want to always sort together. I assume xsl:sort is looking past the artifice
of my fancy footwork and just sorting them where they REALLY are, since the
result of all this is really just pointers pointing to pointers. How can I
fool xsl:sort TOO so that it allows me to sort Zebra to the end of the list?
Thanks for reading and for any thoughts that you might want to offer ;)
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
