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

How to insert a snippet of XSD into HTML using serial

Subject: How to insert a snippet of XSD into HTML using serialize(), without the result containing a bunch of namespaces? Way to suppress the output of namespace declarations?
From: "Costello, Roger L. costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 12 Jun 2015 13:05:14 -0000
 How to insert a snippet of XSD into HTML using  serial
Hi Folks,

I have this XML Schema:

-----------------------------------------------------------------------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
                        xmlns:foo="http://www.foo.org"
                        xmlns:bar="http://www.bar.org"
                        xmlns:blah="http://www.blah.org">

    <xs:element name="Document">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Title" type="xs:string" minOccurs="0" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

</xs:schema>
-----------------------------------------------------------------------------

I want to embed the Title element declaration into an HTML document. That is,
when I view the HTML document in a browser I want this to display:

	<xs:element name="Title" type="xs:string" minOccurs="0" />

In my XSLT, I am using the new serialize function to output the Title
element:

	<xsl:value-of select="serialize(//xs:element[@name eq 'Title'])" />

However, when I view the HTML document in a browser, I see a bunch of
namespace declarations bundled with the Title element:

<xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:foo="http://www.foo.org"
         xmlns:bar="http://www.bar.org"
         xmlns:blah="http://www.blah.org"
         name="Title"
         type="xs:string"
         minOccurs="0"/>

I don't want all those namespace declarations. How do I omit them?

I tried adding a serialization parameter to the serialize function:

<xsl:variable name="output-serialization-parameters" as="element()">
    <output:serialization-parameters
xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization">
        <output:omit-xml-declaration value="yes"/>
        <output:indent value="yes"/>
    </output:serialization-parameters>
</xsl:variable>

<xsl:value-of select="serialize((//xs:element[@name eq 'Title'],
$output-serialization-parameters)" />

That had no effect.

Is there a serialization parameter to suppress the output of namespace
declarations?

What is the solution to this problem?

/Roger

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.