[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: convert an attribute's value to a text node?
> Hi, I am in the process of converting my heavy uses of Saxon > and it's extensions to more standard XSLT 2.0 + XPath 2.0 and > here is the one problem I have left: > > I need to convert a string to a text-node. More specifically, > I need to convert the value of an attribute to a text-node, > because I have special templates that expect text-nodes. > > In the old days I used: > > saxon:node-set(string(@att)) > > which would give me back a text-node. > > Note that saxon's implementation of exsl:node-set would not > allow a string argument, but saxon:node-set would, and would > do exactly what I needed. Actually (for the record), I don't think Saxon ever returned a text node from this function. In Saxon 6.3 and 6.4 a string argument was rejected. In Saxon 6.5 a string argument was accepted, but the result was a document node that owned a text node whose value was the supplied string. The exslt common:node-set() function appears to have changed at some stage and now specifies that with a string argument, the result should be a text node. Saxon has never implemented this version of the EXSLT specification (and I don't recall seeing any discussion of the change - change control is not one of EXSLT's strong points). The most portable way to get a text node from a string, if you really want one, is <xsl:variable name="tree"> <xsl:value-of select="@att"/> </xsl:variable> ... exslt:node-set($tree/text()) ... But it does strike me as a somewhat odd way of doing things. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx 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
|