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

Re(2): adding namespaces to result [XSLT 1.0]

Subject: Re(2): adding namespaces to result [XSLT 1.0]
From: "Fidalgo Sicilia Manuel" <manuel.fidalgo@xxxxxxxxxxxxxxx>
Date: 10 Nov 2006 08:36:00 +0100
xsl manuel
Hi, thanks for the reply. This is the code:

-----XSL------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xbrli="http://www.xbrl.org/2003/instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
  <xsl:template match="/">
       <xsl:element name="namespaces">
              <xsl:variable name="ns" select="/xbrli:xbrl/namespace::*"/>
              <xsl:copy-of select="$ns"/>
       </xsl:element>
  </xsl:template>
</xsl:stylesheet>
--------------------------


-------XML------
<?xml version="1.0" encoding="UTF-8"?>
<xbrli:xbrl xmlns:xbrli="http://www.xbrl.org/2003/instance"
xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.
org/1999/xlink"  xmlns:iso4217="http://www.xbrl.org/2003/iso4217"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</xbrli:xbrl>
-------------------------


-------OUTPUT when I apply XSL to XML------
<?xml version="1.0" encoding="UTF-8"?>
<namespaces iso4217="http://www.xbrl.org/2003/iso4217" link="http://www.xbrl.
org/2003/linkbase" xbrli="http://www.xbrl.org/2003/instance"
xlink="http://www.
w3.org/1999/xlink" xml="http://www.w3.org/XML/1998/namespace"
xsi="http://www.
w3.org/2001/XMLSchema-instance"/>
----------------------------------------


It writes the namespaces in the output but the problem is that these
namespaces
dont have  xmlns: before the namespace prefix. I want these namespaces
exactly
the same as in the XML.

Thank you




Michael Kay  (08/11/2006  19:02):
>
>If the element name, the namespace prefix, and the namespace URI are all
>known to you at the time you write the stylesheet, then all you need to do
>is to use a literal result element:
>
><myElement xmlns:iso4217="http://www.xbrl.org/2003/iso4217">
>  ....
></myElement>
>
>If any of these are not known in advance, then you have to use the technique
>you refer to, of copying a namespace node from another document. You've
>clearly misunderstood how this technique works, but it would be useful to
>see your code so that we can see which part of it you didn't understand.
>
>Michael Kay
>http://www.saxonica.com/
>
>
>>
>> Im trying to create a XML document from another using XSLT.
>> The problem comes when I try to add a namespace to the result
>> (e.g. xmlns:iso4217="http://www.
>> xbrl.org/2003/iso4217"). I have read in post http://www.stylusstudio.
>> com/xsllist/200504/post00350.html that it is not possible to
>> add a namespace with a xsl:attribute, so I tried to use
>> xsl:copy-of with the axe "namespace".
>> This doesnt work fine since it does not add "xmlns:" to the
>> namespace and if I try to add "xmlns:" by hand it does not
>> work because it stops from being an attribute. What can I do?
>>
>> Thanks in advance

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.