RE: Problems with XSL, XML code
Good explanation, John. Maybe I could make just two corrections:
Thanks for those, Evan. (What are you, an editor or something?:) I was trying mainly to nudge the original poster in the right direction; he was too far away from solving the nuances.
1. Why the default namespace? That's not necessary; literal result elements don't have to be in a namespace.
Right. I think I said "you must" or "you need" [i.e., to include the default namespace declaration], which is putting it too strongly. For my own taste, I always prefer to include it. No loose ends. :)
2. If you remove HORA from the template rule's match pattern, the <HORA> child will still be processed by <xsl:apply-templates/>, which processes each child (elements, text, processing instructions, and comments) of the current node. In this case, the children consist only of elements (and whitespace text nodes which don't cause any important difference as will become clear). If a template rule is not found that matches a given child, then the built-in template rule for that node type is used. In the case of an element, the built-in rule is to simply apply templates to its children. <HORA>'s child consists of a text node. Since there are no explicit template rules matching text nodes, the built-in rule for text nodes will be applied, which is to copy the text to the result tree. Thus, you would end up copying "10:08", etc. to the result tree.
Right again. Thanks!
John E. Simpson | "Curiosity killed the cat,
http://www.flixml.org | but for a while I was a
XML Q&A: http://www.xml.com | suspect." (Steven Wright)
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