【问题标题】:updating xsl file with xmlstarlet使用 xmlstarlet 更新 xsl 文件
【发布时间】:2013-07-25 07:05:07
【问题描述】:

trying to update xsl file
   <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
      <xsl:output method="xml" indent="yes" doctype-public="-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" doctype-system="http://java.sun.com/dtd/web-app_2_3.dtd"/>
         <xsl:template match="node()|@*">
    <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="display-name">
    <xsl:copy-of select="."/>
    <filter>
      <filter-name>ssoauthagent</filter-name>
      <filter-class>12234455</filter-class>
    </filter>
    <filter-mapping>
      <filter-name>ssoauthagent</filter-name>
      <url-pattern>/*</url-pattern>
      <dispatcher>INCLUDE</dispatcher>
      <dispatcher>FORWARD</dispatcher>
      <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
  </xsl:template>
</xsl:stylesheet>

wit xmlstarlet 将 ""xsl:stylesheet/xsl:template/filter/filter-class" 的值更改为 "Hello" 给出以下命令,但它给出了错误:-

xml ed -O -u "xsl:stylesheet/xsl:template/filter/filter-class"  -v "Hello" transformWeb.xsl 
XPath error : Undefined namespace prefix
xmlXPathCompiledEval: evaluation failed

我在哪里说错了?

【问题讨论】:

  • 命名空间应该从1.2.0版本开始自动定义;相对路径(没有前导斜杠)只能从版本 1.4.0 开始工作

标签: xsl-fo xmlstarlet


【解决方案1】:

在下面做了并且足够好去

xml ed -N xsl='http://www.w3.org/1999/XSL/Transform' -u '//xsl:stylesheet/xsl:template/filter/filter-class' -v 'hello' /root/transformWeb.xsl

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-02
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多