Questions about using XSLT

Source: Internet
Author: User
Tags xsl xslt xslt processor

1. How to Use call-template? How do I pass parameters and define return values?

A: The XSL: withparam element is used in the call-template field to define the parameters to be passed and the XSL: Param Parameter definition form parameter is defined in the called template.

2. How do I convert the input file namespace to the output file?

Use the XSL: namespace-alias element.

3. How does apply-templates select the template? Is it based on the element name, not the Template Name?

As follows:

<XSL: template match = "message" name = "message">

<H1> <XSL: Apply-templates select = "title"/>

</XSL: Template>

<XSL: template match = "title" name = "title">

<! -- XSL content -->

</XSL: Template>

In addition, if the title processing template is not defined, what is the default processing method?

A: Apply-templates is a processing template for all child elements of the current parent element.

If no processing template is defined, the default behavior is: none.

4. In the same XSL style sheet file, how does the XSLT processor find the one to execute XML Conversion?

For example, in the above example, the title element can be processed from the message template (The apply-templates tag is used), but the template title can also be used for processing?

A: The XSL processing and conversion engine matches the source XML document top-down, from external to internal, with each template, and then selects an appropriate processing template to convert the source XML document. That is to say, nodes processed in the source XML file are no longer processed by other processing templates (unless called multiple times, for example, differentiated by mode ).

5. How do I deal with nodes that do not define a processing template?

A: By default, the text information of nodes is displayed in order.

6. How do I define not to process a node and its children?

A: Use <XSL: template match = "XPath"/>, so that even if a processing template is defined for its child nodes, it will not be 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.