[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Processing inner elements

Subject: Re: Processing inner elements
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Sat, 30 Dec 2006 12:25:26 +0100
Re:  Processing inner elements
Guy wrote:
That's exactly the sort of construct that I was referring to. I guess that
my problem was trying to work out where to look for that sort of
information. For example, what search words would you throw at Google to try
and find pages holding that info?

Guy, in lieu of obviousness ;-) try google with "rename nodes xslt", "rename tags xslt" or any combination. The first hit (on my google: http://www.xml.com/pub/a/2000/06/07/transforming/index.html) is about it (yet I don't find its explanations all too well though, but it gives you some pointers).


An important thing to remember (we all went through that process): when using "copy-of", you cannot add additional control to the contents of what you copy, it will just copy exactly the contents (node tree(s)) of what you specify in the select-attribute. When using "copy" on the other hand, it will only copy the current node (be it text, an element, an attribute), but here you can specify the contents of that node: hence the "apply-templates", which recursively comes back in the same template.

Other rule of thumb (this one I have found hardest to learn) is: "understanding How Templates Work". The processor decides how to do it, you decide what the output should look like (you define the rules). And the important thing to remember is: the most specific rule will be used for any given element. In my post, the first template (with the "copy") is very generic and catches "all other nodes with no specific matches". The other three are specific matches (match for "break", "para" and "image") and define more specific rules for these elements. The processor will use these when it encounters the corresponding nodes in the source, because the rules are more specific.

There's much more to it, of course, and XSLT has quite a steep learning curve. But once you get the basics right, you can do wonders with it (and all the more with XSLT 2).

Cheers,
Abel

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.