Subject: xml declaration not displayed
Posted By: zsheema Post Date: 5/14/2008 5:41:50 AM
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
Reply By: samjudson Reply Date: 5/14/2008 6:04:23 AM
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 -/
Reply By: zsheema Reply Date: 5/14/2008 6:25:14 AM
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
Reply By: mhkay Reply Date: 5/14/2008 6:29:29 AM
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
Reply By: zsheema Reply Date: 5/14/2008 8:12:15 AM
I found out that XML DOM is used for parsing the xml and xslt transformation.
Is that of any help?

Reply By: mhkay Reply Date: 5/14/2008 8:21:01 AM
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
Reply By: zsheema Reply Date: 5/15/2008 12:03:52 AM
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

Reply By: joefawcett Reply Date: 5/15/2008 2:19:05 AM
Try the following stylesheet to see what processor you are using:

<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)
Reply By: mhkay Reply Date: 5/15/2008 3:20:19 AM
>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
Reply By: zsheema Reply Date: 5/15/2008 3:58:39 AM
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?
Reply By: mhkay Reply Date: 5/15/2008 4:36:25 AM
>any comments?

It tells me that it's an XSLT processor I know very little about, and it tells you where to get more information and advice ;-)

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Go to topic 71386

Return to index page 1