[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: selecting an element in an external doc using its
Cindy Mazza wrote:
But when I try to find an element whose id attribute is equal to the value of the 'from' variable, I get an error saying "Unexpected token [<function>] in path expression." You can't use id() this way. A slash '/' in an XPath mus be followed by another step, and functions, like id(), do not fall into this category (in XPath 1.0). Use either a predicete <xsl:message> <xsl:value-of select="$docnode//*[@id=$from]"/> </xsl:message> (supposed all your ID attributes are named "id") or change the context using an xsl:for-each: <xsl:message> <xsl:for-each select="$docnode"> <xsl:value-of select="id($from)"/> </xsl:for-each> </xsl:message> This makes it a bit inconvenient to use id() or key() to grab elements from another document, but so are the rules... J.Pietschmann XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|