需要为带有根元素的段创建子列表格式

时间:2017-08-07 12:32:11

标签: xml xslt

我想为特定的

生成子列表

MYSOURCE

<xsl:template match="p[@outputclass='l1']" priority="122">
    <item num="{replace(node()[1], '^\s+', '')}">
      <para><xsl:apply-templates select="node()[position() gt 2]"/></para>
    </item>
  </xsl:template>
<xsl:template match="p[@outputclass='l2']" priority="122">
    <item num="{replace(node()[1], '^\s+', '')}">
      <para><xsl:apply-templates select="node()[position() gt 2]"/></para>
    </item>
  </xsl:template>
<xsl:template match="p[@outputclass='l3']" priority="122">
    <item num="{replace(node()[1], '^\s+', '')}">
      <para><xsl:apply-templates select="node()[position() gt 2]"/></para>
    </item>
  </xsl:template>

xslt使用:

<item num="(a)"><para>blah blah</para></item>
<item num="(b)"><para>blah blah</para></item>
<item num="(c)"><para>blah blah</para></item>
<item num="(i)"><para>blah blah</para></item>
<item num="(ii)"><para>blah blah</para></item>
<item num="(iii)"><para>blah blah</para></item>
<item num="(iv)"><para>blah blah</para></item>

输出我得出子列表格式:

<orderedlist type="manual">
<item num="(a)"><para>blah blah</para></item>
<item num="(b)"><para>blah blah</para></item>
<item num="(c)"><para>blah blah</para>
<orderedlist type="manual">
<item num="(i)"><para>blah blah</para></item>
<item num="(ii)"><para>blah blah</para></item>
<item num="(iii)"><para>blah blah</para></item>
<item num="(iv)"><para>blah blah</para></item>
</orderedlist>
</item>
</orderedlist>

但我希望输出为子列表格式,如下所示:

$(document).on('click', '.group-link', function() {
                var package_button = $(this),
                    package_id = package_button.attr('data-id'),
                    token = "STFXQAJ0yYLdjiYAI35hrcEZzXRplq3tQRx7EgD0",
                    channels_window = $('#channels_window'),
                    body = $('body');

                channels_window.load("channel.php", { package:package_id, _token:token }, function() {
                    channels_window.fadeIn('slow');
                    body.addClass('window-opened');
                });
            });

请建议我!

0 个答案:

没有答案