XSL learning-calling property values

Source: Internet
Author: User
Tags version xsl
Experience maybe the problem is very simple, but just looked at a lot of introductory tutorials are not involved, fortunately Hsower's introduction of the XSL syntax is described in detail.

<xsl:value-of select= "element name/@ attribute name"/>
For example, a piece of XML code is like this:
< Wang Shuo Web site = "www.wangshuo.com" > famous writer plus well-known critic Mr. Shuo </'s Place
We can use <xsl:value-of select= "Wang Shuo/@ url"/> To get the value "www.wangshuo.com".


Below is an example of my own writing, for your reference.
My.xml
The following are program code:

<?xml version= "1.0" encoding= "GB2312"?>
<?xml-stylesheet type= "text/xsl" href= "mystyle.xsl"?>
<Books>
<book id= "a001" >
<Name> Network Guide </Name>
<Price>13.2</Price>
</Book>
<book id= "a002" >
<Name> LAN Technology </Name>
<Price>25.5</Price>
</Book>
</Books>

mystyle.xsl
The following are program code:

<?xml version= "1.0" encoding= "GB2312"?>
<xsl:stylesheet version= "1.0" xmlns:xsl= "target=_blank>http://www.w3.org/1999/XSL/Transform" >
<xsl:template match= "books/book/*" >
<xsl:value-of select= "./@ID"/>
<br/>
</xsl:template>
</xsl:stylesheet>


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.