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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2016)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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"/>

   
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.