0

我目前在处理此 xml 时遇到问题

<detaileddescription>
    <para>

        ParamText1
        <itemizedlist>
            <listitem>
                <para>Test TextTest TextTest TextTest TextTest Text</para>
            </listitem>
            <listitem>
                <para>Test TextTest TextTest TextTest Text</para>
            </listitem>
        </itemizedlist>
        ParamText2  
    </para>
</detaileddescription>

我使用以下 xslt 文件。

<!-- match each para tag and calls the child nodes -->
  <xsl:template match="para">
    <p class="para">      
      <xsl:apply-templates select="@* | node()" />
    </p>    
  </xsl:template>

  <xsl:template match="itemizedlist">
    <ul>
      <xsl:apply-templates select="*"/>
    </ul>
  </xsl:template>

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

  <xsl:template match="text()">
    <xsl:copy />
  </xsl:template>

我希望收到以下结果

<p class="param">
    ParamText1
    <ul>
        <li>Test TextTest TextTest TextTest TextTest Text</li>
        <li>Test TextTest TextTest TextTest Text</li>
    </ul>
    ParamText2
</p>

但 xslt 将内容转换为

<p class="param">
    ParamText1
</p>
<ul>
    <li>Test TextTest TextTest TextTest TextTest Text</li>
    <li>Test TextTest TextTest TextTest Text</li>
</ul>
ParamText2

我不知道为什么<p>标签在标签之前关闭<ul>

4

0 回答 0