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

Re: Understanding when to use apply-templates with no

Subject: Re: Understanding when to use apply-templates with no selector
From: Karl Stubsjoen <kstubs@xxxxxxxxx>
Date: Sat, 29 Jan 2011 16:20:59 -0700
Re:  Understanding when to use apply-templates with no
Thanks for clarifying!

On Sat, Jan 29, 2011 at 3:31 PM, Brandon Ibach
<brandon.ibach@xxxxxxxxxxxxxxxxxxx> wrote:
> The <xsl:apply-templates/> instruction is equivalent to
> <xsl:apply-templates select="node()"/>, so it will apply templates to
> all child nodes of the context node.
>
> Note that this does *not* include attributes, as they are not "child"
> nodes.  It does, however, include comments, processing instructions
> and text nodes, including whitespace separating elements, if it hasn't
> been stripped out by the processor.
>
> -Brandon :)
>
>
> On Sat, Jan 29, 2011 at 5:25 PM, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote:
>> I see this a lot:
>>
>> <xsl:apply-templates />
>>
>> I have even used it but to be honest, I'm not sure I undertand it
>> completely.  Given the following xml:
>>
>> <a>
>>  <b>
>>  <c>
>>  <d>
>> </a>
>>
>> If the current context is <a> and you call <xsl:apply-templates />,
>> the following template matches will hit:
>> match="a"
>> match="b"
>> match="*"  <!-- which picks up on a match of C and D -->
>>
>> What else gets matched?  If <a> looks like this <a att1="123"
>> att2="456">, we better have attribute matches too?  What about
>> comments and processing instructions?  So if you have.
>> <a>
>>  <!-- this is a comment --!>
>>  <?this is a processing instruction?>
>>  <b>
>> </a>
>>
>> Is there a best practice here to mention?
>>
>> Thanks, just thinking out loud on this.
>> Karl..
>>
>>
>>
>> --
>> Karl Stubsjoen
>> MeetScoresOnline.com
>> (602) 845-0006
>
>



--
Karl Stubsjoen
MeetScoresOnline.com
(602) 845-0006

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.