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

RE: Getting Namespaces into a Transform

From: Michael Kay <mike@saxonica.com>
Date: Tue, 16 Nov 2004 00:57:08 -0000
To: "'Jim Stanley'" <JimS@Media-Services.Com>, <xmlschema-dev@w3.org>
Message-ID: <S-UTL01-DCPOPAtjfh80001c0ba@dcpop.smtp.stsn.com>
xsl namespace alias

> 
> Hope this isn't too off-topic, but I want to insert a schema reference
> in an XSLT transform.  I need for XML document A to transform to
> document B, and I need the following namespace attributes in the root
> node:
> 
> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="NewPPSSchema.xsd" .......>
> 

If you put exactly that in your stylesheet, then you should get exactly that
in your result tree.

It's possible that the XML parser will interpret the
xsi:noNamespaceSchemaLocation attribute as an instruction to validate the
stylesheet against the schema at that location. You should be able to switch
off that interpretation in the parser API, but if you can't, then it may be
safer to generate the attribute using xsl:attribute, or to use a namespace
alias:

<root xmlns:xsia="dummy"
  xsia:noNamespaceSchemaLocation="NewPPSSchema.xsd" .......>

<xsl:namespace-alias stylesheet-prefix="xsia" result-prefix="xsi"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

You didn't actually say what you attempted and how it is failing.

Michael Kay
Received on Tuesday, 16 November 2004 00:57:10 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

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-2007 All Rights Reserved.