[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Matching attributes with namespace

Subject: RE: Matching attributes with namespace
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 3 Aug 2006 19:14:21 +0100
xsl attributes with namespace
Order of attributes in XML is undefined. You can never rely on an XML parser
delivering attributes in a particular order, or on the order being
maintained in a transformation. If you have applications that depend on the
order of attributes then you need to fix them, because they could stop
working with the next release of your XML parser. In fact, since the order
often depends on hashing, they could in principle stop working simply when
you move the application to a different machine.

Michael Kay


> -----Original Message-----
> From: Spencer Tickner [mailto:spencertickner@xxxxxxxxx] 
> Sent: 03 August 2006 19:08
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Matching attributes with namespace
> Hi List,
> Thanks in advance for the help. I have a very simple 
> transformation that I can't seem to get right. The following 
> is a shortened example.
> <?xml version="1.0"?>
> <?xml-stylesheet type="text/xsl" 
> href="../../media/xslt_2.xsl"?> <act 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="../../media/ActSchema.xsd"
> index="96001_01">
>   <title>This is the <insert>title</insert></title> </act>
> <?xml version='1.0'?>
> <xsl:stylesheet version="2.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:template match="/">
> 	<xsl:apply-templates/>
> </xsl:template>
>   <xsl:template match="node()">
>        <xsl:copy>
>             <xsl:copy-of select="@*" />
>             <xsl:apply-templates select="node()" />
>        </xsl:copy>
>   </xsl:template>
> <xsl:template match="insert"><xsl:apply-templates/></xsl:template>
> </xsl:stylesheet>
> So basically just stripping out the insert element. 
> Everything else should stay the same. However my attributes 
> on <act> get jumbled to:
> <?xml version='1.0' ?>
> <?xml-stylesheet type="text/xsl" 
> href="../../media/xslt_2.xsl"?> <act index="96001_01"
> xsi:noNamespaceSchemaLocation="../../media/ActSchema.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>   <title>This is the title</title>
> </act>
> and for whatever reason this is messing up other things in 
> our work-flow. Anyone have any ideas on how to make the <act> 
> attributes come out exactly as they are in the source document?
> Thanks,
> Spencer

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.