XSL Study Notes (1)

Source: Internet
Author: User
Tags xsl xsl file

This document demonstrates the usage of XSL: For-each value-.
The learning of XSL is messy, so the documents are also messy. Most of the main things are in program comments. Take a look ......
Let's take an example: temp. xml

<? XML version = "1.0" encoding = "gb2312"?> <! -- Declaration -->
<? XML-stylesheet type = "text/XSL" href = "test. XSL"?> <! -- Pi -->
<! -- Note that each XML file must have a root element. Document in this file cannot be removed. Otherwise, the two resume files are tied together without the root element. -->
<Document>
<Resume>
<Name> high </Name>
<Age> 23 </age>
</Resume>
<Resume>
<Name> AGAO </Name>
<Age> 23 </age>
</Resume>
</Document>

The following is the test. XSL file.

<? XML version = "1.0" encoding = "gb2312"?>
<XSL: stylesheet xmlns: XSL = "http://www.w3.org/TR/WD-xsl"> <! -- All content is case sensitive -->
<! -- XSL: stylesheet is used for the same purpose as XSL: Transform. It seems that the root element must be defined using XSL: template match. See the following annotations without stylesheet. -->
<XSL: template match = "/">
<Body> <XSL: For-each select = "document/resume"> <! -- Actual relative path/document/resume -->
<XSL: value-of select = "name"/> <! -- Note that the actual path of name here is/document/resume -->
<XSL: value-of select = "Age"> </XSL: value-of> <br/>
</XSL: For-each>
</Body>
</XSL: Template>
</XSL: stylesheet>
<! -- Examples without stylesheet
<XSL xmlns: XSL = "http://www.w3.org/TR/WD-xsl">
<Body>
<XSL: For-each select = "/document/resume"> no match = "/" must be used here/document/resum
<XSL: value-of select = "name"/>
<XSL: value-of select = "Age"> </XSL: value-of> <br/>
</XSL: For-each>
</Body>
</XSL>
-->

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.