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

Re: xpath predicate help

Subject: Re: xpath predicate help
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 17 Feb 2005 20:45:54 GMT
xpath predicate variable
> This however does work.  If I hard-code the id in below it works, If I use a variable as in above it does not work. 
> Any help would be appreciated.

since teh code is the same  with teh exception that you'd replaced the
variable by '456' then I can only assume the variable doesn't have the
value think it should have (eg it has an extra space or two?)
try
<xsl:message>
  [[<xsl:value-of select="$link-target"/>]]
</xsl:message>
and see what comes out.

A few unrelated observations

		<xsl:variable name="link-target"
			<xsl:value-of select="substring-after(./@linkends,' ')"/>
		</xsl:variable>

don't do that here it's just ineffecient but as often comes up you can
get the wrong answer, a result tree fragment isn't needed here you can
just go

		<xsl:variable name="link-target"select="substring-after(./@linkends,' ')"/>

			<xsl:when
			test="name(//*[@id=$link-target])='grphprim'">
better to do //*[@id=$link-target]/self::grphrim
although // is very slow this is crying out to be done bia a key, see
other threads this week.

				<xsl:variable name="parent_graphic" select="//graphic[grphprim/@id=$link-target]"/>
				<xsl:value-of select="$parent_graphic/@id">

The variable isn't needed, you could just inline the expression (and
again using a key may make orders of magnitude speedup

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.