xsl-list
[Top] [All Lists]

[xsl] matching by id in external document()

2006-08-11 00:36:18
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[(_at_)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[(_at_)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


--~------------------------------------------------------------------
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>