Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 22nd, 2010, 01:08 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Please get rid of this awful code:

Code:
<xsl:template match="Ledger">
<xsl:text disable-output-escaping="yes"><![CDATA[<LEDGER>]]></xsl:text>
<xsl:value-of select="." />
<xsl:text disable-output-escaping="yes"><![CDATA[</Ledger>]]></xsl:text>
</xsl:template
The way to write this is:

Code:
<xsl:template match="Ledger">
<LEDGER>
<xsl:value-of select="." />
</LEDGER>
</xsl:template>
Of course if you do that, the start and end tags will have to match - but that's the point. There's an element node in the stylesheet called LEDGER, which is an instruction to add an element node to the result tree.

Get it into your head that XSLT outputs a tree of nodes, not a string of markup text.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old November 22nd, 2010, 02:13 PM
Registered User
 
Join Date: Nov 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default finale

many thanks. A great first Xslt working example.
much more to learn (and unlearn :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Howto get subchild from xml file hacking_mike Javascript How-To 7 March 25th, 2010 09:58 AM
Converting delimited text to separate XML Elements tcblack XSLT 5 March 18th, 2010 06:02 PM
separate file location for different databases Aprile MySQL 1 September 6th, 2007 04:34 PM
file upload processed on separate page vauneen ASP.NET 2.0 Professional 0 August 8th, 2006 03:03 AM
howto test document exists folklayer XSLT 2 October 19th, 2005 05:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.