Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How "apply-templates" works ?

 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This above code will print "Hello" as output. But will it also print content of other child elements content and comment ?

If I have following code


Will this code print following
Content directly under page element
Hello

My confusion is, when we use apply-templates, does it apply to content directly under element or it applies to content within child element also ? By that I mean, if I have not specified template rule for a child element (eg content element in this case), will apply-templates for parent element (page element in this case) also print content of "content" element ? OR will it just print content directly under it and for child element for which template rule is specified (eg title element in this case) ?

I dont know how to set up XSLT environment locally thats why I am unable to test it. So I am putting question here to understand syntax in xslt.

Thanks
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a book chapter on <xsl:apply-templates>: How XSLT Works.

Here's some more information about the default templates used by XSLT in the absence of <xsl:apply-templates> elements: Default Rules.

And I don't understand what you mean by "set up XSLT environment". There's nothing to be set up, you just have to write code which uses XSLT. Everything you need is built into Java already.

You might want to get yourself a book; it's hard to learn a language by asking questions on forums.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic