XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
ajay shahSubject: Hiding declarations in XSLT
Author: ajay shah
Date: 18 Apr 2006 01:04 PM
Hello,
Using: Stylus Studio 6 Enterprise Edition
xslt processor: Saxon 6.5.3

I am trying to hide certain elements in the output but am unable to do so:

<!-- Start: stylesheet.xsl --->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:a="http://www.someurl.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >

<xsl:output method="xml"/>

<elementRoot>
...
</elementRoot>

</xsl:stylesheet>
<!-- End: stylesheet.xsl -->

<!-- Output Obtained --->
<?xml version='1.0' ?>

<elementRoot xmlns:a="http://www.someurl.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
...
</elementRoot>


<!--output Desired -->

<elementRoot>
...
</elementRoot>

i.e I do not want the xml declaration to show up in the output

<?xml version='1.0' ?> should not be included.

Also the elementRoot should not contain any namespace attributes.

Any suggestions on how I would make this happen ?

Thanks

Posttop
Minollo I.Subject: Hiding declarations in XSLT
Author: Minollo I.
Date: 18 Apr 2006 01:18 PM
To remove namespace declarations from the output, you can use the attribute "exclude-result-prefixes" in the <xsl:stylesheet...> element; like:
<xsl:stylesheet .... exclude-result-prefixes="xsi a">

To remove the XML PI from the output, you can add omit-xml-declaration="yes" in your <xsl:output> element:
<xsl:output omit-xml-declaration="yes"/>

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.