[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:variable and node list
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Luke, perhaps your processor supports a node-set() function, many processors support exslt:node-set(), and msxml has a similar function, i think. In the example, i assume a processor that supports exslt:node-set. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ~ xmlns:exslt="http://exslt.org/common"> <xsl:template match="/"> ~ <xsl:variable name='foo'> ~ <bar/> ~ <bar/> ~ <bar/> ~ </xsl:variable> ~ <xsl:value-of select='count(exslt:node-set($foo)/*)'/> </xsl:template> </xsl:stylesheet> This should return '3' run on an arbitrary xml file. Regards, Wolfgang Luke Ambrogio wrote: | ok, thanks. | | thats good but how would i translate this now | | <xsl:variable name="withaddress"> | <xsl:copy-of | select="tblMIMCompanies[contains(translate(@building,$upperCase,$lowerCase), | translate($address,$upperCase,$lowerCase))='true']"/> | <xsl:copy-of | select="tblMIMCompanies[contains(translate(@number,$upperCase,$lowerCase),tr | anslate($address,$upperCase,$lowerCase))='true']"/> | <xsl:copy-of | select="tblMIMCompanies[contains(translate(@street,$upperCase,$lowerCase),tr | anslate($address,$upperCase,$lowerCase))='true']"/> | <xsl:copy-of | select="tblMIMCompanies[contains(translate(@town,$upperCase,$lowerCase),tran | slate($address,$upperCase,$lowerCase))='true']"/> | <xsl:copy-of | select="tblMIMCompanies[contains(translate(@postcode,$upperCase,$lowerCase), | translate($address,$upperCase,$lowerCase))='true']"/> | <xsl:copy-of | select="tblMIMCompanies[contains(translate(@country,$upperCase,$lowerCase),t | ranslate($address,$upperCase,$lowerCase))='true']"/> | <xsl:copy-of | select="tblMIMCompanies[contains(translate(@address,$upperCase,$lowerCase),t | ranslate($address,$upperCase,$lowerCase))='true']"/> | </xsl:variable> | | :) cheers | | ----- Original Message ----- | From: <Jarno.Elovirta@xxxxxxxxx> | To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> | Sent: Friday, October 15, 2004 9:05 AM | Subject: RE: xsl:variable and node list | | | Hi, | | |>i have something like this below |> |><xsl:variable name="withname"> |> <xsl:copy-of |>select="tblMIMCompanies[contains(translate(@name,$upperCase,$l |>owerCase),tran |>slate($name,$upperCase,$lowerCase))'true']"/> |></xsl:variable> | | | I.e. you're binding $withname to a Result Tree Fragment | | |><xsl:variable name="numnam" select="count($withname)"/> | | | but count() expects a node-set. | | |>but the last line is returning me an error than $withname |>does not return a |>nodelist, any ideas what im doing incorrect? | | | You're trying to use a function with an argument of a wrong type. Change the | definition of $withname to | | <xsl:variable name="withname" | select="tblMIMCompanies[contains(translate(@name,$upperCase,$lowerCase),tran | slate($name,$upperCase,$lowerCase))'true']"/> | | Cheers, | | Jarno - Madam Zu: August 2003 Part 1 | | | | | | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBb4D3qjaicDyx8o8RAp1TAJ9uGPSw4dvlxZPHTYuqITdo6dfKGwCgixYs 7mrosX+7nKipTqjCrRs4+DQ= =zQSk -----END PGP SIGNATURE-----
|
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
|