[Home] [By Thread] [By Date] [Recent Entries]
At 2008-12-28 09:38 +0100, nick public wrote:
Ken, I thank you very much for your help. That's just an adaptation of a post someone made long ago on the mail lists. I make a copy available to my XSLT students and on my web site: http://www.cranesoftwrights.com/resources/#debugmsxml As I wrote in my thread, I'm not able to produce an XML output from my XSLT. It is XML that I see output using your stylesheet, only there aren't any elements in the XML. Your stylesheet creates an external parsed XML entity of only text. That is shown by the presence of the XML declaration at the start of the file. I notice that this happen not just for this example but for previous XSLT scripts too. Sorry, I didn't explain what was happening in your stylesheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > The second template above never fires because the priority of the first template will "catch" the <book> element. In that first template rule all you are doing is pushing the child nodes of <book> at your stylesheet, and you are not providing any template rules for it. This means that only the built-in template rules defined by XSLT will be used for your entire structure, and twice for the children of book. Since the built-in template rules will only preserve the values of text and attribute nodes, only the text ends up in your result: t:\ftemp>xslt nick.xml nick-orig.xsl con <?xml version="1.0" encoding="utf-8"?> Gambardella, Matthew
XML Developer's Guide
Computer
44.95
2000-10-01
An in-depth look at creating applications
with XML. Gambardella, Matthew
XML Developer's Guide
Computer
44.95
2000-10-01
An in-depth look at creating applications
with XML.t:\ftemp> Remember that in XSLT only one template rule fires whenever you push a node at your stylesheets. You have two template rules for the same node, and only the template rule with the highest priority will handle the node. I hope this helps. . . . . . . . . . . . . Ken p.s. I note your time zone is central Europe ... I'm running an in-depth, hands-on publicly-subscribed XSLT class in Prague in March as a pre-conference tutorial to the XML Prague'2009 conference: http://www.xmlprague.cz/index.html
|

Cart



