XSLTを使用してivy.xmlファイルを変換すると、基本的に特定のdependency
タグのrev
属性を更新したいと考えています。私の問題はconf
属性であり、私はそれがまったく同じになりたい、残念ながら>
は>
に変換されます。私のツタファイルは次のようになります。XSLTで処理するときに属性に文字がエスケープされないようにする
<ivy-module version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="foo" module="libfoo" revision="1.0.1"/>
<configurations>
</configurations>
<publications>
<artifact name="libfoo" type="jar" conf="default" />
</publications>
<dependencies>
<dependency org="easymock" name="easymock" rev="2.5.2" conf="test->default,class-extension"/>
</dependencies>
</ivy-module>
私のXSLは次のようになります。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output />
<xsl:param name="dependency.rev" />
<xsl:param name="dependency.org" />
<xsl:param name="dependency.name" />
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
</xsl:template>
<xsl:template match="dependency">
<xsl:copy>
<xsl:apply-templates select="node()|@*" />
<xsl:choose>
<xsl:when test="@name=$dependency.name">
<xsl:attribute name="rev">
<xsl:value-of select="$dependency.rev" />
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
と私の出力は次のようになります。私は、明示的にdisable-output-escaping="no"
を設定しようとしました
<dependency org="easymock" name="easymock" rev="2.5.2" conf="test->default,class-extension"/>
conf属性のセットが動作しませんでした。
<xsl:attribute name="conf">
<xsl:value-of select="@conf" disable-output-escaping="yes" />
</xsl:attribute>
どのような壊れたXMLパーサーが結果を正しく読み取れないのですか? –
結果が悪いことは何もありません。 'test- >'と 'test->'はどちらもまったく同じ文字列を表します。 –
あなたが心配する必要がない理由について私の答えを見てください。また、「間違った」属性値が実際には「良い」属性とまったく同じであるという簡単な証拠です。 :) –