[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: question on paths
On 26/05/2010 23:54, Monosij Dutta-Roy wrote:
Ok will try again. Appreciate all your responses before. As Michael said this isn't well formed, i assumed you meant xsl:value-of here but then, as I tried to explain last time you can not evaluate any xpaths in a function unless you pass in a node as a parameter, or otherwise make a node the current item. </xsl:when> <xsl:otherwise>UNDEFINED</xsl:otherwise> </xsl:choose> </xsl:function> --------------- I am writing this function so as to create a variable patientRolePath to hold the value: /n1:Document/n1:recordTarget/n1:patientRole. that isn't a value, it's a fragment of syntax. What do you want to hold, the value obtained by evaluating that path at the current location, or the string " /n1:Document/n1:recordTarget/n1:patientRole" This is because then I can use the variable name patientRolePath and append child nodes and get required values such as: If you have evaluated /n1:Document/n1:recordTarget/n1:patientRole then $patientRolePath will hold a sequence of n1:patientRole nodes and then these expressions would select the children of those nodes.
this appears to be identical to your first question, you can not evaluate / in a function body you need <xsl:sequence selct="root($x)/n1:Document/n1:recordTarget/n1:patientRole"/> where $x is a parameter to your function, and when you call the function you need to pass in a node. as with most declarative languages, a variable can not change its value once it is bound, so an "out" parameter that rebinds a variable with a new value would not make sense in this context.I have written a few other functions so seem to be able to write functions. Maybe it needs to be done with a node test? Also just bought Michael Kay's book so looking forward to it as soon as it reaches here from Amazon. David
|
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
|