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

RE: Re: XPath syntax error problem

Subject: RE: Re: XPath syntax error problem
From: cknell@xxxxxxxxxx
Date: Sat, 22 Jan 2005 15:09:33 -0500
xpath syntax xalan
> " What am I doing wrong?"

The processor has told you what you are doing wrong. You just don't see it.
This is line 24 in your XSL file. 

<xsl:if test="count(//*[substring-after(@ref,':') = $elementName] = 0">

How do I know this without seeing the whole file? The error message told me so.
The error message says that you have failed to include a closing parenthesis for the count() function. Change the line to read like this and that message will go away.

<xsl:if test="count(//*[substring-after(@ref,':') = $elementName] = 0)">

Note the right parenthesis between the '0' and the closing quotation mark. It isn't in your code and that's why the processor is complaining.

-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Joe Fawcett <joefawcett@xxxxxxxxxxx>
Sent:     Sat, 22 Jan 2005 17:29:15 -0000
To:       <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  Re:  XPath syntax error problem

----- Original Message ----- 
From: "Kenneth Stephen" <marvin.the.cynical.robot@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, January 22, 2005 1:32 AM
Subject:  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
> 
>

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

-- 

Joe

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.