好久没用过了,我只是写了一个,没测试,因为IE不显示结果。代码:
<?xml version="1.0" encoding="gb2312" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="书籍信息" />
</body>
</html>
</xsl:template>
<xsl:template match="书籍信息">
<table align="center" border="0" cellpadding="1">
<tr>
<th>题名</th>
<th>价格</th>
<th>订购套数</th>
<th>每套册数</th>
<th>馆藏地</th>
<th>选中标识</th>
<th>分配情况</th>
</tr>
<xsl:apply-templates select="书籍" />
</table>
</xsl:template>
<xsl:template match="书籍">
<tr>
<td>
<xsl:apply-templates select="题名" />
</td>
<td>
<xsl:apply-templates select="价格" />
</td>
<td align="right">
<xsl:apply-templates select="订购套数" />
</td>
<td align="right">
<xsl:apply-templates select="馆藏地" />
</td>
<td align="right">
<xsl:apply-templates select="选中标识" />
</td>
<td align="right">
<xsl:apply-templates select="分配情况" />
</td>
</tr>
</xsl:template>
<xsl:template match="题名">
<xsl:value-of />
</xsl:template>
<xsl:template match="价格">
<xsl:value-of />
</xsl:template>
<xsl:template match="订购套数">
<xsl:value-of />
</xsl:template>
<xsl:template match="馆藏地">
<xsl:value-of />
</xsl:template>
<xsl:template match="选中标识">
<xsl:value-of />
</xsl:template>
<xsl:template match="分配情况">
<xsl:value-of />
</xsl:template>
</xsl:stylesheet>

解决方案 »

  1.   

    不行,你的不能显示,我已经有答案了
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><!-- localized strings -->
    <xsl:variable name='ColumnHeader_ISBN'>ISBN</xsl:variable>
    <xsl:variable name='ColumnHeader_Title'>题名</xsl:variable>
    <xsl:variable name='ColumnHeader_Author'>责任者</xsl:variable>
    <xsl:variable name='ColumnHeader_Price'>价格</xsl:variable>
    <xsl:variable name='ColumnHeader_Count'>订购套数</xsl:variable>
    <xsl:variable name='ColumnHeader_Writer'>丛编</xsl:variable>
    <xsl:variable name='ColumnHeader_Pub'>出版社</xsl:variable><!-- variables -->
    <xsl:variable name='Debug'>0</xsl:variable><xsl:variable name='TableStyle'>font-family:Simsun, Verdana; font-size:75%; text-align:left; vertical-align:top; table-layout:fixed</xsl:variable>
    <xsl:variable name='GutterStyle'>width:2ex</xsl:variable>
    <xsl:variable name='HeaderStyle'>border-bottom:1 solid black</xsl:variable><xsl:variable name='UseZebraStripe'>1</xsl:variable>
    <xsl:variable name='ZebraStripeStyle'>background-color:#e0edff</xsl:variable><xsl:variable name='MostRecentSessionFirst'>0</xsl:variable>
    <xsl:template match="root">    <html dir='ltr'>
        <head>
            <title>
                Message Log for <xsl:value-of select="@LogonName"/>
                <xsl:if test="$Debug = 1"> (Debug)</xsl:if>
            </title>    </head>    <body style='margin:0' >        <table id='BodyTable' style="{$TableStyle}" cellspacing='0' border='0'>            <thead>
                    <tr>
                        <th style="{$HeaderStyle}">
                            <xsl:value-of select="$ColumnHeader_ISBN"/>
                        </th>
                        <th style="{$HeaderStyle}">
                            <xsl:value-of select="$ColumnHeader_Title"/>
                        </th>
                        <th style="{$HeaderStyle}">
                            <xsl:value-of select="$ColumnHeader_Author"/>
                        </th>
                        <th style="{$HeaderStyle}">
                            <xsl:value-of select="$ColumnHeader_Price"/>
                        </th>
                        <th style="{$HeaderStyle}">
                            <xsl:value-of select="$ColumnHeader_Count"/>
                        </th>
                        <th style="{$HeaderStyle}">
                            <xsl:value-of select="$ColumnHeader_Writer"/>
                        </th>
                        <th style="{$HeaderStyle}">
                            <xsl:value-of select="$ColumnHeader_Pub"/>
                        </th>
                    </tr>
                </thead>            <tbody style='vertical-align:top'>
                    <xsl:apply-templates>
                        <xsl:sort select='@ISBN' order='descending' data-type='number'/>
                        <xsl:sort select='@题名'  order='descending'/>
                    </xsl:apply-templates>
                </tbody>
            </table>
        </body>
        </html>
    </xsl:template>
    <xsl:template match="book" name="bookPro">
        <tr>
            <td > <xsl:apply-templates select="ISBN"/> </td>
            <td > <xsl:apply-templates select="题名"/> </td>
            <td > <xsl:apply-templates select="责任者"/> </td>
            <td > <xsl:apply-templates select="价格"/> </td>
            <td > <xsl:apply-templates select="订购套数"/> </td>
            <td > <xsl:apply-templates select="丛编"/> </td>
            <td > <xsl:apply-templates select="出版社"/> </td>
        </tr>
    </xsl:template>
    <xsl:template match="Invitation|InvitationResponse|Join|Leave">
        <tr>
            <xsl:call-template name="CommonMessageProcessing" />
        </tr>
    </xsl:template>
    <xsl:template match="User">
        <!-- add a comma before all but the first user -->
        <xsl:if test="position() != 1">, </xsl:if>
        <xsl:value-of select="@FriendlyName"/>
    </xsl:template>
    <xsl:template name="CommonMessageProcessing">
        <!-- zebra-stripe the sessions -->
        <xsl:if test="$UseZebraStripe = 1">
            <xsl:if test="(@SessionID mod 2) = 1">
                <xsl:attribute name="style">
                    <xsl:value-of select="$ZebraStripeStyle"/>
                </xsl:attribute>
            </xsl:if>
        </xsl:if>
        <xsl:if test="$Debug = 1">
            <td> <xsl:value-of select="@SessionID"/> </td>
            <td/>
        </xsl:if>
        <td> <xsl:value-of select="@Date"/> </td>
        <td> <xsl:value-of select="@Time"/> </td>
    </xsl:template>
    </xsl:stylesheet>