Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: How to sort sequences by scan code? [Thread Next] Re: How to sort sequences by scan code?To: NULL Date: 10/11/2008 11:01:00 AM "Siegfried Heintze" <siegfried@h...> wrote in message news:uKXLMevKJHA.4708@T...... >> You should just do something like: >> <xsl:apply-templates select="//key"> >> <xsl:sort select="scan-code" data-type="number" /> >> </xsl:apply-templates> >> >> <xsl:template match="key"> >> <!-- create array elements here --> >> </xsl:template> >> > Yes but my input data contains a mixture of individual keys and key > sequences. A key sequence (I should have explained this in the initial > post but was hoping everyone would infer it from the data I posted) is a > series of keys of the same size with consequitive scan codes. So Dimitre > and Martin (thanks guys!), in a another post entitled "How to write nested > for loop to generate SVG rectangles" graciously showed me how to expand > these key sequences into individual keys. Now if I want to (1) expand > these key sequences into indivisual keys and (2) sort the resulting > individual keys by scan code can I do that in a single XSLT or do I have > have a two stage pipleline connected by a temporary file? > > Thanks! > Siegfried > Well if you have to you can create a variable describing the new structure and then use msxsl:nodeset() function to turn that variable into a nodeset and then proceed from there. You'll need to do this as it's likely that the variable will be a result tree fragment (RTF) that can't be processed further. Alternatively you can do two transforms or switch to a version 2.0 processor such as Saxon. Version 2.0 doesn't use RTFs. Or you could select on *[@scan-code] which then picks any element with a scan-code attribute. You can match key and key-sequence elements in different templates. -- Joe Fawcett (MVP - XML) http://joe.fawcett.name | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
