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

Re: Problem with Saxon 7.9.1 xsl:variable and selectin

Subject: Re: Problem with Saxon 7.9.1 xsl:variable and selecting additional elements from variable value
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 12 Oct 2005 10:57:07 +0100
Re:  Problem with Saxon 7.9.1 xsl:variable and selectin
> I'm using Saxon 7.9.1 to transform some xml. 

You should probably switch to saxon 8 as soon as possible, saxon 7
implements some early draft of xslt2 but it is very hard for anyone to
remember quite how the language was specified that long ago (saxon 8 has
been out some years now, I think). So any answers you receive will
probably be based on the current xslt2 draft, which is different in
several respects.


		<xsl:variable name="thissection" >
			<xsl:sequence select="../myns:section"/>
		</xsl:variable>

Just as in xslt1 you don't want to do that, which forces the creation of
a new temporary document and foirces all the nodes to be copied.

Just do

<xsl:variable name="thissection" select="../myns:section"/>

so that $thissection just selects the elements that you want.

Without seeing your input I can't say if this is right or not
<xsl:value-of select="$thissection/myns:id"/>
but as you have it defined $thissection is a document node (/) so
"$thissection/myns:id is the top level element of that document if it is
myns:id, and empty otherwise.

As I defined it $thissection is element node, myns:section, so
$thissection/myns:id is the myns:id child of that element.

It doesn't look like you want a variable at all, just:

	<xsl:template match="myns:content" mode="content">
            <mysection origSectionId={../myns:section/myns:id}"/>
            <somedummy>dummy content</somedummy>
	</xsl:template>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.