Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > weird attribute problem

Reply
Thread Tools

weird attribute problem

 
 
noureensyed@gmail.com
Guest
Posts: n/a
 
      11-11-2005
Hi there,


1. I have the following XSL:


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


<xslutput method ="xml" />


<xslaram name="sort-id" select="'Last Name'"/>
<xslaram name="sort-order" select="'ascending'"/>
<xslaram 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: A Weird Appearance for a Weird Site richard HTML 0 01-21-2011 07:10 AM
Re: A Weird Appearance for a Weird Site dorayme HTML 1 01-21-2011 06:51 AM
Re: A Weird Appearance for a Weird Site richard HTML 0 01-21-2011 06:46 AM
newbie with a weird technical problem (@ least I think it's weird) will Ruby 6 12-27-2006 04:46 PM
<xs:attribute> with ref attribute nested in <xs:attribteGroup> does't work problem Aray XML 0 12-19-2006 09:22 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57