Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 14th, 2008, 05:41 AM
Registered User
 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default xml declaration not displayed

Hi All,
Iam using Message designer to create xgm map. I have written an xslt that is linked to the xgm map. In the output xml ,Iam not getting the xml declaration even though I have set the omit-xml-declaration option to 'no'. below is the stmt Iam using
<xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
Please help.
Thanks
Sheema
 
Old May 14th, 2008, 06:04 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Often the XSLT processor you are using will have an effect on whether the XML declaration is output or not.

I can't tell from your post which XSLT processor you are using?

/- Sam Judson : Wrox Technical Editor -/
 
Old May 14th, 2008, 06:25 AM
Registered User
 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Sam,
Thanks for the reply.
how to know about the xslt processor. The Message Designer tool has an option to link the xslt to an xgm map. Iam simply using it. I have no idea about xslt processor.
Is there any way to know/ specify it ourselves?

below is the whole xslt code

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>

<xsl:template match="/">
    <xsl:apply-templates mode="copy"/>
</xsl:template>

<xsl:template match="@*|node()" mode="copy">
    <xsl:if test="normalize-space(.)">
        <xsl:copy>
          <xsl:apply-templates select="@*|node()"
mode="copy"/>
        </xsl:copy>
    </xsl:if>
</xsl:template>
</xsl:stylesheet>

this code is to remove the empty tags from the xml.

I dont have much knowledge about xml/xslt. Please let me know how to proceed.

Thanks,
Sheema
 
Old May 14th, 2008, 06:29 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If xsl:output appears to have no effect, the reason is often that the XML output isn't being serialized by the XSLT processor, but by some other piece of software (for example, the DOM serializer). We need to know more about your processing environment. I'm afraid "Message designer" and "xgm" aren't terms that ring any bells.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 14th, 2008, 08:12 AM
Registered User
 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found out that XML DOM is used for parsing the xml and xslt transformation.
Is that of any help?

 
Old May 14th, 2008, 08:21 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I think you will need to find a forum where you can ask about the specific technologies you are using.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 15th, 2008, 12:03 AM
Registered User
 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok..will do that...
I have another question...
when I use CDATA, '<' is outputted as #60;
Iam using UTF-8 encoding.
Can anyone help me out with this..

Thanks,
Sheema

 
Old May 15th, 2008, 02:19 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Try the following stylesheet to see what processor you are using:
Code:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">
<html>
<body>
<p>
Version:
<xsl:value-of select="system-property('xsl:version')" />
<br />
Vendor:
<xsl:value-of select="system-property('xsl:vendor')" />
<br />
Vendor URL:
<xsl:value-of select="system-property('xsl:vendor-url')" />
</p>
</body>
</html>
</xsl:template></xsl:stylesheet>

--

Joe (Microsoft MVP - XML)
 
Old May 15th, 2008, 03:20 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>when I use CDATA, '<' is outputted as #60;

Since we have no idea what serialization technology you are using, it's going to be hard to answer your questions.

But what do you mean anyway by saying "when I use CDATA"? And are you talking about a "<" that's part of the markupl, or part of the data?

You aren't making it very easy for people to help you. Please try to say exactly what you did and exactly what happened.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 15th, 2008, 03:58 AM
Registered User
 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the stylesheet...
from the stylesheet provided, I got the below result :

<html>
   <body>
      <p>
Version:
1<br/>
Vendor:
Oracle Corporation.<br/>
Vendor URL:
http://www.oracle.com</p>
   </body>
</html>

any comments?





Similar Threads
Thread Thread Starter Forum Replies Last Post
xml declaration chroniclemaster1 XML 0 September 20th, 2007 02:00 PM
xml displayed in textbox GS C# 2005 1 August 31st, 2007 12:45 PM
omit-xml-declaration dextermagnific XSLT 3 August 4th, 2006 09:55 AM
XML to be displayed in a pop-up crmpicco Classic ASP Basics 1 February 10th, 2005 09:19 AM
Create XML Doc with Stylesheet Declaration rodmcleay General .NET 1 November 15th, 2004 04:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.