|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Writing a stylesheet to create a stylesheet, with
Scott Moore wrote: > <Sections label="<xsl:value-of select="/Doc/FirstName"/>"/> > > Okay, let me try again. The above snippet is in my XML file. Why? I'm asking rhetorically; it's generally a bad idea to try to embed markup as character data, and then expect it to be markup upon output. > I want to > process the <Sections> node and basically do this in my stylesheet: > > <xsl:value-of select="@label"/> > > Unfortunately, that produces the following in the result tree: > > <xsl:value-of select="/Doc/FirstName"/> Ah, but it doesn't. It produces in the result *tree* a single text node containing the pseudo-markup < x s l : v a l u e - o f and so on, with spaces added to emphasize that it's character data. If you intend to produce <xsl:value-of...> in the *serialization* of the result tree, then you must have not a text node but an element node with this structure: element named 'value-of' in namespace 'http://www.w3.org/1999/XSL/Transform' \___attribute 'select' with value '/Doc/FirstName' So, why not have <Sections> <label> <xsl:value-of select="/Doc/FirstName"/> </label> </Sections> and then <xsl:copy-of select="label/*"/> ? (Don't forget to declare the xsl prefix in the source as well) > <xsl:text disable-output-escaping="yes"><xsl:value-of > select="@label"/></xsl:text> > > BUT, the above is an error. You apparently cannot place an <xsl:value-of/> > inside of a <xsl:text/> element. xsl:text and xsl:value-of do exactly the same thing. They create a text node in the result tree. The character data encapsulated by the text node is going to be the content of xsl:text element, or the result of evaluating the XPath expression given in the select attribute of the xsl:value-of. On either element, you can use disable-output-escaping="yes", but of course it's not portable and not recommended, blah blah etc. - Mike ____________________________________________________________________________ mike j. brown | xml/xslt: http://skew.org/xml/ denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/ 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
|






