以下の構造のxmlファイルがあります
<project>
<dependency id="abc" version="1.2.3.4"/>
</project>
このxmlを読み、idとversionの値で別のxmlを更新する必要があります。以前、私は以下のようなxslを使用してこれを実行しましたが、これは正常に機能していました。
<xsl:attribute name="id">
<xsl:value-of select="@id"/>
</xsl:attribute>
<xsl:attribute name="version">
<xsl:value-of select="@version"/>
</xsl:attribute>
バージョンの属性値を[1.2,1.3)に設定する必要がありますが、どうすればよいですか?以下のようなことを試しましたが、どこにも行かないと思います。
<xsl:variable name="MinVersion"/>
<xsl:variable name="MaxVersion"/>
<xsl:for-each select="tokenize(@version,'.')">
<xsl:if test="(position( )) = 2">
<xsl:value-of select="concat($MinVersion,.)"/>
</xsl:if>
<xsl:otherwise>
<xsl:value-of select="concat($MinVersion,.,'.')"/>
</xsl:otherwise>
<xsl:if test="(position( )) = 2">
<xsl:value-of select="concat($MaxVersion,number(.)+1)"/>
</xsl:if>
<xsl:otherwise>
<xsl:value-of select="concat($MaxVersion,.,'.')"/>
</xsl:otherwise>
</xsl:for-each>
これどうやってするの?
更新:Visual Studioでこれをデバッグしようとしましたが、tokenizeが認識された機能ではないことを示すエラーメッセージが表示されました。いくつか検索した結果、.NETFrameworkはXSLT1.0プロセッサのみをサポートしています。1.0を使用したソリューションが役立ちます。