Subject: Re: [xsl] error testing id() in external document From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 19 Oct 2007 13:24:06 -0400 |
Using xsltproc (libxml), and thus inside an <xsl:stylesheet version="1.0">,
the following template generates an error:
<xsl:template match="jump[@srcfile]"> <xsl:variable name="jfil" select="substring-before(@srcfile,'#')" /> <xsl:variable name="jid" select="substring-after(@srcfile,'#')" /> <!-- footnotes are an invalid external reference --> <xsl:if test="local-name(document($jfil,/)/id($jid)) = 'footnote'">
<xsl:message terminate="yes"> <xsl:text>Footnote reference to external document (</xsl:text> <xsl:value-of select="@srcfile" /> <xsl:text> found in </xsl:text> <xsl:value-of select="$myfullself" /> </xsl:message> </xsl:if> </xsl:template>
The error is:
XPath error : Invalid expression xsl:if : could not compile test expression 'local-name(.. etc.
Is that really an invalid expression? Is there a valid expression that will achieve the same thing?
<xsl:template match="jump[@srcfile]"> <xsl:variable name="jfil" select="substring-before(@srcfile,'#')" /> <xsl:variable name="jid" select="substring-after(@srcfile,'#')" /> <xsl:variable name="srcfile" select="@srcfile"/> <!-- footnotes are an invalid external reference --> <xsl:for-each select="document($jfil,/)"> <xsl:if test="local-name(id($jid)) = 'footnote'"> <xsl:message terminate="yes"> <xsl:text>Footnote reference to external document (</xsl:text> <xsl:value-of select="$srcfile" /> <xsl:text> found in </xsl:text> <xsl:value-of select="$myfullself" /> </xsl:message> </xsl:if> </xsl:for-each> </xsl:template>
-- Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008 World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Jul'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] error testing id() in ext, Michael Kay | Thread | RE: [xsl] error testing id() in ext, Trevor Nicholls |
RE: [xsl] error testing id() in ext, Michael Kay | Date | Re: [xsl] extend an xslt template d, Anthony Ettinger |
Month |