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

Re: namespaces problem

Subject: Re: namespaces problem
From: "belangour abdessamad" <abdessamad.belangour@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Oct 2003 09:40:58 +0100
elementformdefault qualified problem
Thanks for answering me,
I have litteraly written the result, it did suceed. but the problem is that
all the namespaces on  the <xsl:stylesheet> element also appear on the
result file.
What do i have to do to select namspaces that have to appear on the result
file and to forbid the others?
Thanks again.

----- Original Message ----- 
From: "Jeni Tennison" <jeni@xxxxxxxxxxxxxxxx>
To: "belangour abdessamad" <abdessamad.belangour@xxxxxxxxxxxxxxxxxxx>
Cc: "XSL-list" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, October 29, 2003 6:15 PM
Subject: Re:  namespaces problem


> Hi,
>
> > I'm trying to automatically generate a schema using XSLT.
> > How can i please generate the attributes "targetNamespace="MyDoc" and
> > xmlns:my="MyDoc" as in the example:
>
> --------------------------------------------------------------------------
--
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="MyDoc" xmlns:my="MyDoc" elementFormDefault="qualified">
>
> --------------------------------------------------------------------------
--
>
> Namespace declarations (attributes that start with xmlns) are not
> really attributes, and you can't create them as if they were. Instead,
> if a namespace is in-scope for the instruction that you use to create
> an element, then a namespace declaration will usually be placed on the
> element.
>
> The easiest thing to do is just use a literal result element like:
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="MyDoc" xmlns:my="MyDoc"
> elementFormDefault="qualified">
> ...
> </xsd:schema>
>
> Usually, I'd put the namespace declarations that I want to appear in
> the output on the <xsl:stylesheet> element, so something like:
>
> <xsl:stylesheet version="1.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>                 xmlns:my="MyDoc">
>
> <xsl:template match="/">
>   <xsd:schema targetNamespace="MyDoc"
>               elementFormDefault="qualified">
>     ...
>   </xsd:schema>
> </xsl:template>
>
> </xsl:stylesheet>
>
> That way, they remain in-scope throughout the stylesheet, which means
> that you don't run into problems with namespace un-declarations.
>
> Note that elements generated with <xsl:element> *don't* automatically
> get namespace nodes for the namespaces that are in-scope for the
> instruction. This is another reason to use literal result elements
> instead of generating them with <xsl:element>.
>
> Cheers,
>
> Jeni
>
> ---
> Jeni Tennison
> http://www.jenitennison.com/
>
>
>  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.