Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is template rule in xsl ?

 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following example is taken from the link "http://edutechwiki.unige.ch/en/XSLT_Tutorial_-_Basics#A_first_glance_at_XSLT"

xml file that contains content



xsl file used to transform xml in html


What does <xsl:apply-templates/> do ?
I was reading this example online and it was sated that
<xsl:apply-templates/> means: "go and look for other rules"
what does this mean ? where does the control go, when it encounters
<xsl:apply-templates/> as there is no other rule for root element "page" ?

in this example, we have "title" as a child element of "page" element. To access "title", do we need to have template for root elelment , <xsl:template match="page"> ? Can we access "title" without template for "page" like as follows by placing forward slash before "title" ?


I have read in other book that <xsl:apply-templates> is used when there unstructured content and tags in that unstructured cntent is t be matched. e.g. there are some <bold> texts in a paragraph and we can apply <B> for all the occurrences of <bold> using <xsl:apply-templates/> this secod use makes more sense to me. So does i mean that <xsl:apply-templates> can be used for both purposes ? Are these two purposes same or different ? Please explain if there is something wrong in understanding.

Please explain the use of <xsl:apply-templates> as its very confusing and has already taken lot of my time



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic