使用xmlstarlet更新xsl文件

时间:2013-07-25 07:05:08

标签: xsl-fo xmlstarlet

im

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>

知道xmlstarlet这样可以更改&#34;&#34; xsl:stylesheet / xsl:template / filter / filter-class&#34;重视&#34;你好&#34;给出以下命令,但它给出了错误: -

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

AM我把它弄错了?

1 个答案:

答案 0 :(得分:0)

在下面做得足够好

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