M
mikea_59
I continue to see diferences between XSLT 2.0 engines. Specifically
XMLSpy 2005 and Saxon. I have been using XMLSpy to develop some XSLT
because of the nice debugging environment. When I move my code to Saxon
I often get something completely different. I'm still a newbie to XSL
so I'm not sure which one is correct (I lean towards Saxon, but I'm not
sure). Here is the latest case in point.
I have the following simple example of an input xml file:
<ROOT >
<MAIN>
<flag1>CC</flag1>
<flag2>BB</flag2>
<flag3></flag3>
</MAIN>
</ROOT>
This is the desired output:
flag1=CC flag2=BB
and here is the XSL:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="text" omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:apply-templates select="//*"/>
</xsl:template>
<xsl:template match="*">
<xsl:if test="text()">
<xsl:value-of select="name()"/>=<xsl:value-of select="."/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
In XMLSpy I get the desired output:
flag1=CC flag2=BB
In Saxon I get this:
ROOT=
CC
BB
MAIN=
CC
BB
flag1=CC flag2=BB
This seems like a really simple translation but I can't get it to
work in Saxon. I can't take advantage of element names because thay are
not fixed - although the pattern is consistent the element names change
for each xml instance file. Can someone point out why I am getting
different results. How can I get the desired output in Saxon?
XMLSpy 2005 and Saxon. I have been using XMLSpy to develop some XSLT
because of the nice debugging environment. When I move my code to Saxon
I often get something completely different. I'm still a newbie to XSL
so I'm not sure which one is correct (I lean towards Saxon, but I'm not
sure). Here is the latest case in point.
I have the following simple example of an input xml file:
<ROOT >
<MAIN>
<flag1>CC</flag1>
<flag2>BB</flag2>
<flag3></flag3>
</MAIN>
</ROOT>
This is the desired output:
flag1=CC flag2=BB
and here is the XSL:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="text" omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:apply-templates select="//*"/>
</xsl:template>
<xsl:template match="*">
<xsl:if test="text()">
<xsl:value-of select="name()"/>=<xsl:value-of select="."/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
In XMLSpy I get the desired output:
flag1=CC flag2=BB
In Saxon I get this:
ROOT=
CC
BB
MAIN=
CC
BB
flag1=CC flag2=BB
This seems like a really simple translation but I can't get it to
work in Saxon. I can't take advantage of element names because thay are
not fixed - although the pattern is consistent the element names change
for each xml instance file. Can someone point out why I am getting
different results. How can I get the desired output in Saxon?