1.xml
<person>
   <name>李</name>
   <age>32</age>
   <sex>男</sex>
<person>
如何分别显示name,age,sex内容?
这个xslt如何编写?
谢谢!

解决方案 »

  1.   

    XML:
    <?xml version="1.0" encoding="utf-8"?>
    <?xml-stylesheet type="text/xsl" href="test.xsl" ?>
    <ROOT>
    <PARAM NAME="ALBUM_ID" VALUE="36713" />
    <PARAM NAME="MV_ID" VALUE="123" />
    <PARAM NAME="ALBUM_IMG" VALUE="fffff.jpg" />
    </ROOT>XSL:
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" />
    <xsl:template match="ROOT">
    <table border="1">
    <tr>
    <td>ID</td>
    <td>NAME</td>
    <td>VALUE</td>
    </tr>
    <xsl:apply-templates select="PARAM" />
    </table>
    </xsl:template>
    <xsl:template match="PARAM">
    <tr>
    <td><xsl:number value="position()" /></td>
    <td><xsl:value-of select="@NAME" /></td>
    <td><xsl:value-of select="@VALUE" /></td>
    </tr>
    </xsl:template>
    </xsl:stylesheet>
      

  2.   

    楼上这位说的很好
    可是,我的xml和你的稍微有点不同呀!
    请问,我的上面的那个xml如何读取呀?
      

  3.   

    <ea:FieldList TableName="Table1" Style="Normal">
    <ea:FieldItem>
    <ea:FieldName>name</ea:FieldName>
    <ea:FieldDisplayName>姓名</ea:FieldDisplayName
    <ea:Length>50</ea:Length>
    <ea:IsTwoColumn>true</ea:IsTwoColumn>
    <ea:CodeTable>user</ea:CodeTable>
    </ea:FieldItem>
    <ea:FieldItem>
    <ea:FieldName>age</ea:FieldName>
    <ea:FieldDisplayName>年龄</ea:FieldDisplayName
    <ea:Length>50</ea:Length>
    <ea:IsTwoColumn>true</ea:IsTwoColumn>
    <ea:CodeTable>user</ea:CodeTable>
    </ea:FieldItem>
    <ea:FieldItem>
    <ea:FieldName>sex</ea:FieldName>
    <ea:FieldDisplayName>性别</ea:FieldDisplayName
    <ea:Length>50</ea:Length>
    <ea:IsTwoColumn>true</ea:IsTwoColumn>
    <ea:CodeTable>user</ea:CodeTable>
    </ea:FieldItem>
    </ea:FieldList>