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> |