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

Re: How to output a xmlns:prefix attribute (special ca

Subject: Re: How to output a xmlns:prefix attribute (special case)
From: "Richard Gruet" <rgruet@xxxxxxxxxxxxx>
Date: Thu, 12 Jul 2001 16:12:10 -0700
prefix.com
Jarno,

Thanks for the long answer !
However, it seems that your solutions require that I declare the namespace
prefix in my stylesheet. Unfortunately, in my case this prefix determined at
run time (it is the value of an attribute in the source document) , so
obviously I can declare it in the stylesheet.

Richard

Jarno.Elovirta@xxxxxxxxx wrote:

> Hip hei!
>
> [d:\temp]type test.xsl
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet version="1.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>                 xmlns:prefix="http://prefix.com">
>
> <xsl:output method="xml"
>             indent="yes"
>             encoding="ISO-8859-1" />
>
> <xsl:template match="/">
>   <xsd:schema>
>     <xsl:copy-of select="document('')/*/namespace::prefix" />
>     <xsd:complexType name="prefix:typeName" />
>   </xsd:schema>
> </xsl:template>
>
> </xsl:stylesheet>
>
> [d:\temp]saxon -t test.xsl test.xsl
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:prefix="http://prefix.com">
>    <xsd:complexType name="prefix:typeName"/>
> </xsd:schema>
>
> Was this what you were after? Anyhow, note that you
>
> Note that you can't do
>
>   <xsd:schema targetNamespace="http://whatever.com">
>     <xsl:copy-of select="document('')/*/namespace::prefix" />
>     <xsd:complexType name="prefix:typeName" />
>   </xsd:schema>
>
> with Saxon 6.4.2, it throws an run-time error "Cannot copy a namespace node
> to an element after attributes have been added". In jd.xslt, MSXML, and
> Xalan this works. With Saxon you can do it by using xsl:attribute
>
>   <xsd:schema>
>     <xsl:copy-of select="document('')/*/namespace::prefix" />
>     <xsl:attribute
> name="targetNamespace">http://whatever.com</xsl:attribute>
>     <xsd:complexType name="prefix:typeName" />
>   </xsd:schema>
>
> Hope this helps
>
> Jarno
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.