473,411 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Differences between XSL engines

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">
<xsl:output 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?

Jul 20 '05 #1
2 1078

I would guess that xml spy is using MXSML. That parser has a documented
non-conformance to the XML specification in its default state.
It discards white space text nodes.
To get a conformant XML parser you need to set the presevewhitespace
property to true.

In this case you probably want to discard the white space text nodes,
but the parser is not supposed to do it by default (and saxon is giving
the right answer)

add <xsl:strip-space elements="*"/> to remove white space text nodes
from the input.
David
Jul 20 '05 #2

XMLSpy uses it's own parser by default.

I added the <xsl:strip-space elements="*"/> and that worked in Saxon,
thanks a bunch!

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Aardwolf | last post by:
I have recently started to convert several of my websites over to dynamic sites with pages written as requested with php and in some cases using mysql databases to supply data within parts of the...
1
by: WindAndWaves | last post by:
Hi Gurus How do I provide links that search engines can follow if my site is created in PHP and MySql and I always put the session ID in the link (header)? Are there any special tricks? ...
0
by: R. Rajesh Jeba Anbiah | last post by:
Q: Is PHP search engine friendly? Q: Will search engine spiders crawl my PHP pages? A: Spiders should crawl anything provided they're accessible. Since, nowadays most of the websites are been...
1
by: Deforgel | last post by:
Hello, I'm wondering if anyone can shed some experience on how to have search engines index a website that is a store using products stored in an asp database. I've been creating static html...
0
by: only_me | last post by:
Not a coding question as such but highly related to asp/dynamic pages issues : has anyone any suggestions on the following ASP sites are generally (always) of a dynamic nature, pages can be...
2
by: Patrick | last post by:
Are the differences between a search engine, a subject directory and a meta search engine significant for an ebusiness web site owner? A meta search engine merely uses ordinary existing search...
39
by: Noticedtrends | last post by:
Can inference search-engines narrow-down the number of often irrelevant results, by using specific keywords; for the purpose of discerning emerging social & business trends? For example, if...
64
by: Manfred Kooistra | last post by:
I am building a website with identical content in four different languages. On a first visit, the search engine determines the language of the content by the IP address of the visitor. What the...
0
by: passion | last post by:
"Specialized Search Engines" along with Google Search Capability (2 in 1): http://specialized-search-engines.blogspot.com/ Billions of websites are available on the web and plenty of extremely...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.