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

Creating namespace nodes

Subject: Creating namespace nodes
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Tue, 7 Jun 2005 03:21:21 -0700 (PDT)
 Creating namespace nodes
I am using XSLT 1.0 ;)

"I need to write a identity transform, and add a
namespace node to a particular element in the result
tree.."

I have written the following XSLT (1.0) stylesheet so
far ..

<?xml version="1.0"?> 
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
 
<xsl:output method="xml" indent="yes" /> 

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

<xsl:template match="h">
  <xsl:copy>
    <xsl:attribute name="temp"
namespace="http://whatever" />
    <xsl:apply-templates select="node() | @*" />
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>

The input XML is -

<?xml version="1.0"?>
<a id="10">
  <b id="9">
    <c id="8">
      <d id="7">
        <a id="5">
          <h id="6" />          
        </a>
      </d>
    </c>
  </b>
</a>  

The output produced with the above stylesheet is -

Warning: Running an XSLT 1.0 stylesheet with an XSLT
2.0 processor
<?xml version="1.0" encoding="UTF-8"?>
<a id="10">
     <b id="9">
          <c id="8">
               <d id="7">
                    <a id="5">
                         <h temp: id="6"/>

                    </a>
               </d>
          </c>
     </b>
</a>

I am using Saxon 8.4 ..

I desire output -

<?xml version="1.0" encoding="UTF-8"?>
<a id="10">
     <b id="9">
          <c id="8">
               <d id="7">
                    <a id="5">
                         <h
xmlns:temp="http://whatever" id="6"/>
                    </a>
               </d>
          </c>
     </b>
</a>

I'll appreciate any help ..

Regards,
Mukul



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.