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

RE: Required item type of first operand of '/' is node

Subject: RE: Required item type of first operand of '/' is node(); supplied value has item type xs:string
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 23 Apr 2010 14:37:40 +0100
RE:  Required item type of first operand of '/' is node
Variables in XSLT represent values, not fragments of expression text. It's
not a macro language. You can use the variable $name anywhere you would use
a string literal, for example

select="//x/*[local-name() = $name]/description"

Take care with namespaces.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay  

> -----Original Message-----
> From: Jacobus Reyneke [mailto:jacobusreyneke@xxxxxxxxx] 
> Sent: 23 April 2010 14:09
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Required item type of first operand of '/' is 
> node(); supplied value has item type xs:string
> 
> Good day,
> 
> I have found a million references to this problem on the 
> Internet, but I still can't get my template to work. People 
> are typically experiencing these issues in functions and 
> parameter passing. My application is very simple, but the 
> solution keeps avoiding me.
> 
> I'm trying to use an element name as part of a path to a 
> central dictionary for my problem domain's terms. I'm keeping 
> the vocabulary under a different namespace so that I can move 
> it out later.
> 
> The following template:
>     <xsl:template match="c:*">
>         <xsl:variable name="name" select="local-name()"/>
>         <xsl:apply-templates
> select="//c:smart-lookup-list/$name/description/node()"/>
>      </xsl:template>
> 
> Is not working and gives the error described above.
> 
> If I hardcode a value (lets say 'monkey') then off course it works:
>     <xsl:template match="c:*">
>         <xsl:variable name="name" select="local-name()"/>
>         <xsl:apply-templates
> select="//c:smart-lookup-list/monkey/description/node()"/>
>      </xsl:template>
> 
> I'll be grateful for any guidance.
> 
> Kind regards,
> Jacobus

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.