|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Newbie question - does the built-in template rules out
Hi all,
Another newbie question, this time about XSL itself rather than xsltproc. (sorry!) Quoting from XSLT for Dummies, it says: ------------------------------------8<---------------------------------- For text and attribute nodes, a built-in template rule copies their text through into the result tree: <xsl:template match="text()|@*"> <xsl:value-of select="."/> </xsl:template> In this rule, the match pattern returns all text nodes with text() and all attribute nodes with @*. The xsl:value-of instruction then transforms the current node to the result tree as text. ------------------------------------8<---------------------------------- However, if I run this against a blank stylesheet: ------------------------------------8<---------------------------------- <!-- miniscore.xml --> <score id="1">Text here <film name="I should see this attribute">A Little Princess</film> <composer>Patrick Doyle</composer> <year>1995</year> <grade>100</grade> </score> ------------------------------------8<---------------------------------- The result is: ------------------------------------8<---------------------------------- <?xml version="1.0" encoding="utf-8"?>Text here A Little Princess Patrick Doyle 1995 100 ------------------------------------8<---------------------------------- However, since the attribute node name is supposedly matched, I expected: ------------------------------------8<---------------------------------- <?xml version="1.0" encoding="utf-8"?>Text here I should see this attribute A Little Princess Patrick Doyle 1995 100 ------------------------------------8<---------------------------------- Can anyone tell me where I'm wrong? cheers, -pm http://oceanclub.blogspot.com "It is said that at the age of 55 each man becomes what he most despised at the age of 25. I live in constant fear lest I become a badly organised trip to Bournemouth."
|
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
|

Cart








