【问题标题】:how to append data in xslt on button click using jquery?如何在使用 jquery 的按钮单击时在 xslt 中附加数据?
【发布时间】:2023-04-10 23:19:01
【问题描述】:

您能告诉我如何使用 jquery 在单击按钮时在 xslt 中附加数据吗? 我试过这样

 <button onclick='clickBtn()'>append</button>

JS函数

function clickBtn(){
        console.log('=====')
          '<xsl:for-each select="//./body/name">
              <xsl:if test='number(position()) &gt;10'>
                  <li><xsl:value-of select="."/></li>
               </xsl:if>
          </xsl:for-each>'
          }

这是我的代码 http://xsltransform.net/jz1PuQ7/8

有什么更新吗?

【问题讨论】:

    标签: javascript jquery xml xslt xslt-2.0


    【解决方案1】:

    XSL 的输出是 HTML。输出 HTML 不知道 XSL 或 XML 数据。您可能想做的是向 XML 结构添加一个元素并重新执行 XSL 转换。

    在此处查看使用 JavaScript 运行 XSL 转换的示例:How can I use javascript to transform xml & xslt

    在此处查看将节点添加到 XML 结构(在 jQuery 中与在 HTML 元素中相同):jQuery 1.6.1 add a new node in XML

    【讨论】:

    猜你喜欢
    • 2020-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-12
    • 2019-02-13
    • 2017-04-05
    • 1970-01-01
    • 2021-04-28
    相关资源
    最近更新 更多