weird attribute problem

Discussion in 'XML' started by noureensyed@gmail.com, Nov 11, 2005.

  1. Guest

    Hi there,


    1. I have the following XSL:


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


    <xsl:eek:utput method ="xml" />


    <xsl:param name="sort-id" select="'Last Name'"/>
    <xsl:param name="sort-order" select="'ascending'"/>
    <xsl:param name="sort-type" select="'text'"/>


    <xsl:template match="@* | node()">
    <xsl:copy>
    <xsl:apply-templates select="@* | node()" />
    </xsl:copy>
    </xsl:template>


    <xsl:template match="DATATABLE[@ID='TARGET']">
    <xsl:copy>
    <xsl:apply-templates select="@* | ROW">
    <xsl:sort select="COLUMN[@ID = $sort-id]/@VALUE"
    data-type="{$sort-type}" order="{$sort-order}" lang="en" />
    </xsl:apply-templates>
    </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>


    2. When I apply this to an XML of the form:
    <DATATABLES>
    <DATATABLE ID="TARGET">
    <ROW ID="0">
    <COLUMN>...</COLUMN>
    <COLUMN>...</COLUMN>
    </ROW>
    <ROW ID="1">... </ROW>
    <ROW ID="2">
    <COLUMN>...</COLUMN>
    ......
    </ROW>
    </DATATABLE>
    <DATATABLE ID="something else">....
    </DATATABLE>
    </DATATABLES>


    I get the desired result, all good! BUT if I change the sort-order
    param to "'descending'", my resulting xml loses the ID="TARGET"
    attribute!!!? How can I fix this behaviour and why is it happening?


    Thank you.
     
    , Nov 11, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dorayme
    Replies:
    1
    Views:
    630
    richard
    Jan 21, 2011
  2. richard
    Replies:
    0
    Views:
    594
    richard
    Jan 21, 2011
  3. richard
    Replies:
    0
    Views:
    622
    richard
    Jan 21, 2011
  4. Beauregard T. Shagnasty

    Re: A Weird Appearance for a Weird Site

    Beauregard T. Shagnasty, Jan 21, 2011, in forum: HTML
    Replies:
    1
    Views:
    446
    Captain Paralytic
    Jan 21, 2011
  5. will
    Replies:
    6
    Views:
    426
    Phrogz
    Dec 27, 2006
Loading...

Share This Page