View Single Post
  #3 (permalink)  
Old July 7th, 2007, 06:30 AM
tall rog tall rog is offline
Registered User
 
Join Date: Jul 2007
Location: Wroclaw, , Poland.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tall rog
Default

Hi Michael ,

 thanks for the suggestion. I tried to post a response yesterday, but for some reason the server appeared to be down. I can see how it is working. Creating a variable of ordered CMP elements. Then creating a sequence of CMP@num attributes with 5 'NA' strings to the end of the sequence. Then showing the first 5 of the combined sequence. It all makes sense however the ordering does not seem to work.

  I created the following...

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>

<xsl:template match="FLD1">

      <xsl:variable name="sorted-CMPs" as="element()*">
         <xsl:perform-sort select="CMP">
            <xsl:sort select="@num"/>
         </xsl:perform-sort>
      </xsl:variable>

      <xsl:value-of select="($sorted-CMPs/@num,
          'NA', 'NA', 'NA', 'NA', 'NA')[position()=1 to 5]"
        separator="|"/>
      <xsl:text>|</xsl:text>

</xsl:template>

</xsl:stylesheet>

And the result I get is..

    11|13|12|14|NA|

    21|23|22|NA|NA|

    02|01|NA|NA|NA|

So the CMP elements are not sorted and also two new lines seem to be thrown even though there is no:
    <xsl:text>#13;</xsl:text>

So I thought that possibly this was a problem with Saxon (V8.9j). So I installed Xalan (j_2_7_0) but that won't even accept the 'as' attribute in the <xsl:variable> element.

I will spend more time on this over the weekend, I clearly have a lot more reading to do...

Rog


---------------------------------------------------------
Insert witty interesting comment here...
Reply With Quote