Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How to sort sequences by scan code?

From: "Joe Fawcett" <joefawcett@---------.------>
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 



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent