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

matching by id in external document()

Subject: matching by id in external document()
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Fri, 11 Aug 2006 19:35:51 +1200
 matching by id in external document()
Hi

This template works - it accesses the correct target element in the external
document based on its id attribute matching the suffix of the local srcfile
attribute.

 <xsl:template match="jump[@srcfile]">
   <xsl:variable name="jfil">
     <xsl:value-of select="substring-before(@srcfile,'#')" />
   </xsl:variable>
   <xsl:variable name="jid">
     <xsl:value-of select="substring-after(@srcfile,'#')" />
   </xsl:variable>
   <xsl:copy>
     <xsl:apply-templates select="@*[local-name() != 'text']"/>
     <xsl:attribute name="text">
       <xsl:value-of select="document($jfil,/)//target[@id = $jid]" />
     </xsl:attribute>
   </xsl:copy>
 </xsl:template>


I was hoping that the following edit would be more efficient (it would
replace the 11th line of the preceding template):

       <xsl:value-of select="document($jfil,/)/id($jid)" />

But this is an invalid XPath expression. What am I doing wrong?

Cheers
Trevor

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.