How to Understand template calls in XSLT (I am a newbie, I am not well-written, and everyone is hitting the bricks)

Source: Internet
Author: User
Tags xslt

How to Understand template calls in XSLT
Because the style sheet is descriptive rather than procedural, we will not assume that the first template is the start of the call, nor take "/" as a sitting

Start node.
The style sheet discovers the call relationship between templates and automatically finds the call start point.
For example:
Source. xml
/*------------*/
<? XML version = "1.0"?>
<? XML-stylesheet type = "text/XSL" href = "books. XSL"?>
<Source>

<Bold> Hello, world. </bold>
<Red> I am </red>
<Italic> fine. </italic>

</Source>

Books. XSL
/*-----------*/
<XSL: stylesheet version = '1. 0'
Xmlns: XSL = 'HTTP: // www.w3.org/5o/#/transform'>
<XSL: output method = "html" indent = "yes"/>















<XSL: template match = "/source">
<XSL: Apply-templates select = "/"/>
</XSL: Template>

</XSL: stylesheet>

Result:
Hello, world.

I am

Fine.

<XSL: Apply-templates select = "/"/> is a call statement. The select attribute selects the context node again.

The template that matches the current context node is called.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.