I have a xml file with below structure
<project>
<dependency id="abc" version="1.2.3.4"/>
</project>
I need to read this xml and update another xml with the value of id and version. Earlier i did this with an xsl like below, which was working fine:
<xsl:attribute name="id">
<xsl:value-of select="@id"/>
</xsl:attribute>
<xsl:attribute name="version">
<xsl:value-of select="@version"/>
</xsl:attribute>
Now I need to set the attribute value of version as [1.2,1.3), how can I do this? I tried something like this below, but I dont think I'm getting no where.
<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>
How can I do this?
UPDATE: I tried to debug this in Visual Studio and got error message stating tokenize is not a recognized function. After some searching found .NET framework supports only XSLT 1.0 processor. Any solution with 1.0 would be helpful.
XslCompiledTransformandXslTransform) are XSLT 1.0 processors but there are third party XSLT 2.0 processors like the .NET version of Saxon 9 saxon.sourceforge.net/#F9.4HE or AltovaXML (usable in .NET via COM interop) or XmlPrime. So that way you can use thetokenizefunction in XSLT with .NET.