xsl-list
[Top] [All Lists]

Re: XPath syntax error problem

2005-01-22 10:29:15
----- Original Message ----- From: "Kenneth Stephen" <marvin(_dot_)the(_dot_)cynical(_dot_)robot(_at_)gmail(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Saturday, January 22, 2005 1:32 AM
Subject: [xsl] XPath syntax error problem


Hi,

   I have the following template in my XSL :

<xsl:template match="xsd:element">
<xsl:variable name="elementName" select="@name" />
<xsl:if test="count(//*[substring-after(@ref,':') = $elementName] = 0">
<xsl:if test="count(@name) = 1">
<xsl:if test="/xsd:schema/@elementFormDefault = 'qualified'">
<xsl:value-of select="concat($prefix,':')" />
</xsl:if>
<xsl:value-of select="@name" />
</xsl:if>
</xsl:if>
<xsl:text>&eol;</xsl:text>
</xsl:template>

   On execution, Saxon (and Xalan too) complain about a syntax error
on the outermost "xsl:if" . The Saxon error is shown below :

bash-2.05b$ java net.sf.saxon.Transform ../data/Metadata_0101.xsd
analyze-schema.xsl
Error at xsl:if on line 24 of
file:/C:/cygwin/home/zaphod/code/analyze-schema.xsl:
 XPath syntax error in {...(@ref,':') = $elementName] ...}:
   expected ")", found "<eof>"
Transformation failed: Failed to compile stylesheet. 1 error detected.


   What am I doing wrong? What I want to do is find out if the value
of the "name" attribute on an xsd:element in the input occurs within a
"ref" attribute elsewhere in my XML Schema file.

Thanks,
Kenneth

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



You are missing a closing parenthesis:
test="count(//*[substring-after(@ref,':') = $elementName] = 0"
=>
test="count(//*[substring-after(@ref,':') = $elementName]) = 0"

--

Joe

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