1

我正在编写一个将修改现有菜单输出的应用程序。我有很多方法可以做到这一点,我认为其中之一是 XSLT,但我是此类转换的完全初学者。

我希望更改以下内容:

<ul>
  <li><a href="#">Item1</a>
    <ul>
      <li class="featured"><a href="#">Item 1.1</a></li>
      <li><a href="#">Item 1.2</a></li>
      <li class="featured"><a href="">Item 1.3</a></li>
      <li><a href="#">Item 1.4</a></li>
    </ul>
  </li>
</ul>

给新的:

<ul>
  <li><a href="#">Item1</a>
    <ul>
      <li>
        <ul>
          <li><a href="#">Item 1.1</a></li>
          <li><a href="#">Item 1.2</a></li>
          <li><a href="#">Item 1.3</a></li>
          <li><a href="#">Item 1.4</a></li>
        </ul>
      </li>
      <li>
        <ul class="featured">
           <li><a href="#">Item 1.1</a></li>
           <li><a href="#">Item 1.3</a></li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

我有以下问题:

对于上述情况,我需要什么转换?

我将如何限制只有 n 级深度(在这种情况下,我们不希望包含项目的子ul.ul.ul.li项,即项目 xx)?

如果我只想将此变换应用于顶部<ul>具有属性的样式class="style1",并且如果将其设置"style2"为应用不同的变换怎么办?

4

2 回答 2

1

我不是 100% 确定您为什么要添加额外的级别,ul并且我不确定“n 级别”深度要求(更好的示例会有所帮助),但这应该可以帮助您入门:

XSLT 1.0

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="ul[@class='style1']/li">
        <xsl:copy>
            <xsl:apply-templates select="@*|*[not(self::ul)]"/>
            <ul>
                <li>
                    <xsl:apply-templates select="ul"/>
                </li>
                <li>
                    <ul class="featured">
                        <xsl:apply-templates select="ul/li[@class='featured']"/>
                    </ul>
                </li>
            </ul>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="li">
        <xsl:copy>
            <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>

</xsl:stylesheet>

输出

<ul class="style1">
   <li>
      <a href="#">Item1</a>
      <ul>
         <li>
            <ul>
               <li>
                  <a href="#">Item 1.1</a>
               </li>
               <li>
                  <a href="#">Item 1.2</a>
               </li>
               <li>
                  <a href="">Item 1.3</a>
               </li>
               <li>
                  <a href="#">Item 1.4</a>
               </li>
            </ul>
         </li>
         <li>
            <ul class="featured">
               <li>
                  <a href="#">Item 1.1</a>
               </li>
               <li>
                  <a href="">Item 1.3</a>
               </li>
            </ul>
         </li>
      </ul>
   </li>
</ul>
于 2012-08-24T04:11:31.337 回答
1

你可以试试这个 XSLT

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:php="http://php.net/xsl"  exclude-result-prefixes="php" version="1.0">
  <xsl:output method="html" version="1.0" encoding="utf-8" indent="yes"  omit-xml-declaration="no"/>

  <xsl:template match="/">
    <div id="menu">
      <ul id="mega">
        <xsl:for-each select="//Menu/MainMenu">
          <xsl:choose>
            <xsl:when  test="@isdisplay=1 and @iscategory=1">
              <xsl:element name="li">
                <xsl:attribute name="style">
                  border-left:#ffffff 1px solid;
                </xsl:attribute>
                <xsl:attribute name="class">
                  <xsl:value-of select="@class"/>
                </xsl:attribute>
                <xsl:variable name="name">
                  <xsl:value-of select="@name"/>
                </xsl:variable>
                <xsl:element name="a">
                  <xsl:attribute name="href">
                    <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php',$name,'','','')"/>
                  </xsl:attribute>
                  <xsl:value-of select="@displayname"/>
                </xsl:element>
                <xsl:if test="count(SubMenu) > 0">
                  <xsl:choose>
                    <xsl:when test="@name='Outdoor Gear'">
                      <div>
                        <xsl:apply-templates select="//Menu/MainMenu[@name='Outdoor Gear']">
                        </xsl:apply-templates>
                      </div>
                    </xsl:when>
                    <xsl:when test="@name='Clothing / Footwear'">
                      <div style="width:490px !important;">
                        <xsl:apply-templates select="//Menu/MainMenu[@name='Clothing / Footwear']"></xsl:apply-templates>
                      </div>
                    </xsl:when>
                    <xsl:when test="@name='Electronics'">
                      <div style="width:200px !important;">
                        <xsl:apply-templates select="//Menu/MainMenu[@name='Electronics']"></xsl:apply-templates>
                      </div>
                    </xsl:when>
                    <xsl:when test="@name='Gifts'">
                      <div style="width:200px !important;">
                        <xsl:apply-templates select="//Menu/MainMenu[@name='Gifts']"></xsl:apply-templates>
                      </div>
                    </xsl:when>
                    <xsl:when test="@name='Petzl'">
                      <div style="width:200px !important;">
                        <xsl:apply-templates select="//Menu/MainMenu[@name='Petzl']"></xsl:apply-templates>
                      </div>
                    </xsl:when>
                  </xsl:choose>
                </xsl:if>
              </xsl:element>
            </xsl:when>
            <xsl:when  test="@isdisplay=1 and @iscategory=0">
              <xsl:element name="li">
                <xsl:attribute name="style">
                  border-left:#ffffff 1px solid;
                </xsl:attribute>
                <xsl:attribute name="class">
                  <xsl:value-of select="@class"/>
                </xsl:attribute>
                <xsl:variable name="name">
                  <xsl:value-of select="@name"/>
                </xsl:variable>
                <xsl:element name="a">
                  <xsl:attribute name="href">
                    <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','',$name,'','','')"/>
                  </xsl:attribute>
                  <xsl:value-of select="@displayname"/>
                </xsl:element>
              </xsl:element>
            </xsl:when>
          </xsl:choose>
        </xsl:for-each>
      </ul>
    </div>
  </xsl:template>

  <xsl:template match="//Menu/MainMenu[@name='Outdoor Gear']">
    <span class="main">
      <h2>
        <xsl:variable name="name">
          <xsl:value-of select="SubMenu[@name='Water Sport']/@name"/>
        </xsl:variable>
        <xsl:element name="a">
          <xsl:attribute name="href">
            <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,'','')"/>
          </xsl:attribute>
          <xsl:value-of select="SubMenu[@name='Water Sport']/@displayname" disable-output-escaping="yes"/>
        </xsl:element>
      </h2>
      <xsl:for-each select="SubMenu[@name='Water Sport']/SubSubMenu">
        <xsl:if test="@isdisplay=1">
          <span class="inner">
            <xsl:variable name="name">
              <xsl:value-of select="//Menu/MainMenu[@name='Outdoor Gear']/SubMenu[@name='Water Sport']/@name"/>
            </xsl:variable>
            <xsl:variable name="name1">
              <xsl:value-of select="@name"/>
            </xsl:variable>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,'')"/>
              </xsl:attribute>
              <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
            </xsl:element>
          </span>
        </xsl:if>
        <xsl:for-each select="ChildMenu">
          <xsl:if test="@isdisplay=1">
            <span class="inner">
              <xsl:variable name="name">
                <xsl:value-of select="../../@name"/>
              </xsl:variable>
              <xsl:variable name="name1">
                <xsl:value-of select="../@name"/>
              </xsl:variable>
              <xsl:variable name="name2">
                <xsl:value-of select="@name"/>
              </xsl:variable>
              <xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,$name2)"/>
                </xsl:attribute>
                <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
              </xsl:element>
            </span>
          </xsl:if>
        </xsl:for-each>
      </xsl:for-each>

      <br clear="all"  />
      <h2>
        <xsl:variable name="name">
          <xsl:value-of select="SubMenu[@name='Archery']/@name"/>
        </xsl:variable>
        <xsl:element name="a">
          <xsl:attribute name="href">
            <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,'','')"/>
          </xsl:attribute>
          <xsl:value-of select="SubMenu[@name='Archery']/@displayname" disable-output-escaping="yes"/>
        </xsl:element>
      </h2>
      <xsl:for-each select="SubMenu[@name='Archery']/SubSubMenu">
        <xsl:if test="@isdisplay=1">
          <span class="inner">
            <xsl:variable name="name">
              <xsl:value-of select="//Menu/MainMenu[@name='Outdoor Gear']/SubMenu[@name='Archery']/@name"/>
            </xsl:variable>
            <xsl:variable name="name1">
              <xsl:value-of select="@name"/>
            </xsl:variable>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,'')"/>
              </xsl:attribute>
              <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
            </xsl:element>
          </span>
        </xsl:if>
        <xsl:for-each select="ChildMenu">
          <xsl:if test="@isdisplay=1">
            <span class="inner">
              <xsl:variable name="name">
                <xsl:value-of select="../../@name"/>
              </xsl:variable>
              <xsl:variable name="name1">
                <xsl:value-of select="../@name"/>
              </xsl:variable>
              <xsl:variable name="name2">
                <xsl:value-of select="@name"/>
              </xsl:variable>
              <xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,$name2)"/>
                </xsl:attribute>
                <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
              </xsl:element>
            </span>
          </xsl:if>
        </xsl:for-each>
      </xsl:for-each>

      <h2>
        <xsl:variable name="name">
          <xsl:value-of select="SubMenu[@name='Climbing']/@name"/>
        </xsl:variable>
        <xsl:element name="a">
          <xsl:attribute name="href">
            <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,'','')"/>
          </xsl:attribute>
          <xsl:value-of select="SubMenu[@name='Climbing']/@displayname" disable-output-escaping="yes"/>
        </xsl:element>
      </h2>
      <xsl:for-each select="SubMenu[@name='Climbing']/SubSubMenu">
        <xsl:if test="@isdisplay=1">
          <span class="inner">
            <xsl:variable name="name">
              <xsl:value-of select="//Menu/MainMenu[@name='Outdoor Gear']/SubMenu[@name='Climbing']/@name"/>
            </xsl:variable>
            <xsl:variable name="name1">
              <xsl:value-of select="@name"/>
            </xsl:variable>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,'')"/>
              </xsl:attribute>
              <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
            </xsl:element>
          </span>
        </xsl:if>
        <xsl:for-each select="ChildMenu">
          <xsl:if test="@isdisplay=1">
            <span class="inner">
              <xsl:variable name="name">
                <xsl:value-of select="../../@name"/>
              </xsl:variable>
              <xsl:variable name="name1">
                <xsl:value-of select="../@name"/>
              </xsl:variable>
              <xsl:variable name="name2">
                <xsl:value-of select="@name"/>
              </xsl:variable>
              <xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,$name2)"/>
                </xsl:attribute>
                <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
              </xsl:element>
            </span>
          </xsl:if>
        </xsl:for-each>
      </xsl:for-each>

      <br clear="all"  />
      <h2>
        <xsl:variable name="name">
          <xsl:value-of select="SubMenu[@name='Fishing']/@name"/>
        </xsl:variable>
        <xsl:element name="a">
          <xsl:attribute name="href">
            <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,'','')"/>
          </xsl:attribute>
          <xsl:value-of select="SubMenu[@name='Fishing']/@displayname" disable-output-escaping="yes"/>
        </xsl:element>
      </h2>
      <xsl:for-each select="SubMenu[@name='Fishing']/SubSubMenu">
        <xsl:if test="@isdisplay=1">
          <span class="inner">
            <xsl:variable name="name">
              <xsl:value-of select="//Menu/MainMenu[@name='Outdoor Gear']/SubMenu[@name='Fishing']/@name"/>
            </xsl:variable>
            <xsl:variable name="name1">
              <xsl:value-of select="@name"/>
            </xsl:variable>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,'')"/>
              </xsl:attribute>
              <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
            </xsl:element>
          </span>
        </xsl:if>
        <xsl:for-each select="ChildMenu">
          <xsl:if test="@isdisplay=1">
            <span class="inner">
              <xsl:variable name="name">
                <xsl:value-of select="../../@name"/>
              </xsl:variable>
              <xsl:variable name="name1">
                <xsl:value-of select="../@name"/>
              </xsl:variable>
              <xsl:variable name="name2">
                <xsl:value-of select="@name"/>
              </xsl:variable>
              <xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,$name2)"/>
                </xsl:attribute>
                <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
              </xsl:element>
            </span>
          </xsl:if>
        </xsl:for-each>
      </xsl:for-each>
    </span>

    <span class="main">
      <h2>
        <xsl:variable name="name">
          <xsl:value-of select="SubMenu[@name='Track / Field / Court / Indoors']/@name"/>
        </xsl:variable>
        <xsl:element name="a">
          <xsl:attribute name="href">
            <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,'','')"/>
          </xsl:attribute>
          <xsl:value-of select="SubMenu[@name='Track / Field / Court / Indoors']/@displayname" disable-output-escaping="yes"/>
        </xsl:element>
      </h2>
      <xsl:for-each select="SubMenu[@name='Track / Field / Court / Indoors']/SubSubMenu">
        <xsl:if test="@isdisplay=1">
          <span class="inner">
            <xsl:variable name="name">
              <xsl:value-of select="//Menu/MainMenu[@name='Outdoor Gear']/SubMenu[@name='Track / Field / Court / Indoors']/@name"/>
            </xsl:variable>
            <xsl:variable name="name1">
              <xsl:value-of select="@name"/>
            </xsl:variable>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,'')"/>
              </xsl:attribute>
              <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
            </xsl:element>
          </span>
        </xsl:if>
        <xsl:for-each select="ChildMenu">
          <xsl:if test="@isdisplay=1">
            <span class="inner">
              <xsl:variable name="name">
                <xsl:value-of select="../../@name"/>
              </xsl:variable>
              <xsl:variable name="name1">
                <xsl:value-of select="../@name"/>
              </xsl:variable>
              <xsl:variable name="name2">
                <xsl:value-of select="@name"/>
              </xsl:variable>
              <xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,$name2)"/>
                </xsl:attribute>
                <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
              </xsl:element>
            </span>
          </xsl:if>
        </xsl:for-each>
      </xsl:for-each>

      <br clear="all"  />
      <h2>
        <xsl:variable name="name">
          <xsl:value-of select="SubMenu[@name='Hiking and Camping']/@name"/>
        </xsl:variable>
        <xsl:element name="a">
          <xsl:attribute name="href">
            <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,'','')"/>
          </xsl:attribute>
          <xsl:value-of select="SubMenu[@name='Hiking and Camping']/@displayname" disable-output-escaping="yes"/>
        </xsl:element>
      </h2>
      <xsl:for-each select="SubMenu[@name='Hiking and Camping']/SubSubMenu">
        <xsl:if test="@isdisplay=1">
          <span class="inner">
            <xsl:variable name="name">
              <xsl:value-of select="//Menu/MainMenu[@name='Outdoor Gear']/SubMenu[@name='Hiking and Camping']/@name"/>
            </xsl:variable>
            <xsl:variable name="name1">
              <xsl:value-of select="@name"/>
            </xsl:variable>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,'')"/>
              </xsl:attribute>
              <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
            </xsl:element>
          </span>
        </xsl:if>
        <xsl:for-each select="ChildMenu">
          <xsl:if test="@isdisplay=1">
            <span class="inner">
              <xsl:variable name="name">
                <xsl:value-of select="../../@name"/>
              </xsl:variable>
              <xsl:variable name="name1">
                <xsl:value-of select="../@name"/>
              </xsl:variable>
              <xsl:variable name="name2">
                <xsl:value-of select="@name"/>
              </xsl:variable>
              <xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Outdoor Gear',$name,$name1,$name2)"/>
                </xsl:attribute>
                <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
              </xsl:element>
            </span>
          </xsl:if>
        </xsl:for-each>
      </xsl:for-each>
    </span>
  </xsl:template>

  <xsl:template match="//Menu/MainMenu[@name='Clothing / Footwear']">
    <span class="main">
      <h2>
        <xsl:variable name="name">
          <xsl:value-of select="SubMenu[@name='Mountain Running']/@name"/>
        </xsl:variable>
        <xsl:element name="a">
          <xsl:attribute name="href">
            <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Clothing / Footwear',$name,'','')"/>
          </xsl:attribute>
          <xsl:value-of select="SubMenu[@name='Mountain Running']/@displayname" disable-output-escaping="yes"/>
        </xsl:element>
      </h2>
      <xsl:for-each select="SubMenu[@name='Mountain Running']/SubSubMenu">
        <xsl:if test="@isdisplay=1">
          <span class="inner">
            <xsl:variable name="name">
              <xsl:value-of select="../@name"/>
            </xsl:variable>
            <xsl:variable name="name1">
              <xsl:value-of select="@name"/>
            </xsl:variable>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Clothing / Footwear',$name,$name1,'')"/>
              </xsl:attribute>
              <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
            </xsl:element>
          </span>
        </xsl:if>
        <xsl:for-each select="ChildMenu">
          <xsl:if test="@isdisplay=1">
            <span class="inner">
              <xsl:variable name="name">
                <xsl:value-of select="../../@name"/>
              </xsl:variable>
              <xsl:variable name="name1">
                <xsl:value-of select="../@name"/>
              </xsl:variable>
              <xsl:variable name="name2">
                <xsl:value-of select="@name"/>
              </xsl:variable>
              <xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Clothing / Footwear',$name,$name1,$name2)"/>
                </xsl:attribute>
                <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
              </xsl:element>
            </span>
          </xsl:if>
        </xsl:for-each>
      </xsl:for-each>
    </span>
  </xsl:template>

  <xsl:template match="//Menu/MainMenu[@name='Electronics']">
    <table width="100%" border="0" cellspacing="2" cellpadding="2">
      <tr>
        <td height="5"></td>
      </tr>
      <xsl:for-each select="SubMenu">
        <tr>
          <td class="">
            <xsl:variable name="name">
              <xsl:value-of select="@name"/>
            </xsl:variable>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Electronics',$name,'','')"/>
              </xsl:attribute>
              <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
            </xsl:element>
          </td>
        </tr>
      </xsl:for-each>
    </table>
  </xsl:template>

  <xsl:template match="//Menu/MainMenu[@name='Gifts']">
    <table width="100%" border="0" cellspacing="2" cellpadding="2">
      <tr>
        <td height="5"></td>
      </tr>
      <xsl:for-each select="SubMenu">
        <tr>
          <td class="">
            <xsl:variable name="name">
              <xsl:value-of select="@name"/>
            </xsl:variable>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Gifts',$name,'','')"/>
              </xsl:attribute>
              <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
            </xsl:element>
          </td>
        </tr>
      </xsl:for-each>
    </table>
  </xsl:template>

  <xsl:template match="//Menu/MainMenu[@name='Petzl']">
    <table width="100%" border="0" cellspacing="2" cellpadding="2">
      <tr>
        <td height="5"></td>
      </tr>
      <xsl:for-each select="SubMenu">
        <tr>
          <td class="">
            <xsl:variable name="name">
              <xsl:value-of select="@name"/>
            </xsl:variable>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="php:function('ClsXSLTFunction::makeFriendlyURL','Category.php','Petzl',$name,'','')"/>
              </xsl:attribute>
              <xsl:value-of select="@displayname" disable-output-escaping="yes"/>
            </xsl:element>
          </td>
        </tr>
      </xsl:for-each>
    </table>
  </xsl:template>
</xsl:stylesheet>

如果您遇到任何问题,请告诉我。

于 2012-08-24T03:13:55.570 回答