xsl-list
[Top] [All Lists]

Re: xpath predicate help

2005-02-17 13:45:54

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(//*[(_at_)id=$link-target])='grphprim'">
better to do //*[(_at_)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
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>