[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem with Saxon 7.9.1 xsl:variable and selecting a

Subject: Problem with Saxon 7.9.1 xsl:variable and selecting additional elements from variable value
From: Olaf Meske <omeske@xxxxxxxxxxx>
Date: Wed, 12 Oct 2005 11:36:51 +0200
saxon xsl variable
Hi,

I'm using Saxon 7.9.1 to transform some xml. Within this transformation
I set a variable to a node. Somewhat later I try to select a value from
a subnode of this variable node, but it gives me nothing. With the
XML-Spy engine this works for me, but not with Saxon 7.9.1 (which I have
to use for some other reasons).
So If someone could give me an advice how to do this with saxon 7.9.1 or
what else to do.
I would be very grateful if someone could help me.

Regards
Olaf


This is my XML file: -------------------- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml-stylesheet type="text/xsl" href="tinytest.xsl"?> <document xmlns="http://www.example.com/NameSpace" > <main> <section> <name>my section</name> <id>100</id> </section> <content> <id>contentid 2</id> <text>the content itself</text> </content> </main> </document>

======================
This is the tinytest.xsl xml style sheet:
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:myns="http://www.example.com/NameSpace">
	<xsl:template match="/">
		<myNexDoc>
		<version>
		version: <xsl:value-of select="system-property('xsl:version')" />
		vendor: <xsl:value-of select="system-property('xsl:vendor')" />
		vendor-url: <xsl:value-of select="system-property('xsl:vendor-url')" />
		product: <xsl:value-of select="system-property('xsl:product')" />
		product-version: <xsl:value-of
select="system-property('xsl:product-version')" />
		</version>
		<xsl:apply-templates select="//myns:content" mode="content" />
		</myNexDoc>
	</xsl:template>	
	
	<xsl:template match="myns:content" mode="content">
		<xsl:variable name="thissection" >
			<xsl:sequence select="../myns:section"/>
		</xsl:variable>
		<mysection>
			<xsl:attribute name="origSectionId">
				<xsl:value-of select="$thissection/myns:id"/>
			</xsl:attribute>
		</mysection>
		<somedummy>dummy content</somedummy>
	</xsl:template>
	
</xsl:stylesheet>

==========================
Here is the XML-Spy result (pritty print)(which is what I'm expecting):
With the right value for mysection/@origSectionId
---------------------------
<?xml version="1.0" encoding="UTF-8"?>
<myNexDoc xmlns:myns="http://www.example.com/NameSpace">
	<version>
		version: 2.0
		vendor: Altova GmbH
		vendor-url: http://www.altova.com
		product:
		product-version: </version>
	<mysection origSectionId="100" />
	<somedummy>dummy content</somedummy>
</myNexDoc>

===========================
Here is the Saxon result (pritty print)
With the empty value for mysection/@origSectionId
--------------------------
<?xml version="1.0" encoding="UTF-8"?>
<myNexDoc xmlns:myns="http://www.example.com/NameSpace">
	<version>
		version: 2.0
		vendor: SAXON 7.9.1 from Saxonica
		vendor-url: http://saxon.sf.net/
		product:
		product-version: 7.9.1</version>
	<mysection origSectionId=""/>
	<somedummy>dummy content</somedummy>
</myNexDoc>

============================

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.