[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: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Thu, 12 Jul 2001 09:15:08 +0100
xslt output xmlns attribute
If the namespace you require is declared in the stylesheet, and you output a
literal result element, then you will get a namespace declaration output for
it.

If you can't do that, another solution is to add a dummy attribute to the
output, with the name prefix:att.

If you're really desparate, create a separate XML file of the form

<dummy xmlns:prefix="my-uri"/>

and do <xsl:copy-of select=document('dummy.xml')/*/namespace::prefix"/>

(this relies on something in the XSLT 1.0 errata so it may not work on all
processors, but it should work with Saxon).

Mike Kay
Software AG

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> Richard Gruet
> Sent: 12 July 2001 01:33
> To: XSL-list
> Subject:  How to output a xmlns:prefix attribute (special case)
>
>
> Hi all,
>
> I'm trying to generate a XML-Schema from a definition in a custom
> language of my own (itself validated by an XML-Schema), using an XSLT
> stylesheet.
> Because my language allows some kind of "imports" that will be
> translated to xsd:import elements + xmlns:prefix attributes in the
> generated schema, I need to add the xmlns:prefix declarations to the
> output xsd:schema element.
>
> Unfortunately, as I am generating xml (not mere text), the XSLT
> processor (Saxon 6.4, but it is probably a general rule)
> prevents me to
> do this, by forbidding to add this particular attribute. Instead, it
> detects output elements or attributes whose names are qualified with a
> prefix, and inserts automatically the corresponding xmlns:prefix
> declarations in the output top element.
>
> But it does not work for me, since the references to the
> qualified types
> occur only as *values* of an attribute, not directly as element or
> attribute names, e.g in:
>
> <xsd:complexType name="prefix:typeName">
>
> ..in that case, the XSLT processor does not know that it
> should include
> a xmlns:prefix declaration in my top xsd:schema element, and anyway it
> would not know where to take the URI for that namespace (I
> won't declare
> *every* possible namespace on the planet in my stylesheet ;-).
>
> So I'm stuck: the processor prevents me to put explicitely xmlns
> declarations, but OTOH does not do it by itself, so what to do ?
> Should I switch to text output mode to bypass the controls ?
> Is there a
> clevier way to proceed ?
>
> Thanks for any advice,
>
> Richard Gruet
>
>
>  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.