Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8719039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:41:38+00:00 2026-06-13T06:41:38+00:00

I have a xml file with below structure <project> <dependency id=abc version=1.2.3.4/> </project> I

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:41:39+00:00Added an answer on June 13, 2026 at 6:41 am

    Try following, Hope it will solve your problem.(I have Changed my prevous answer, check following new one.)

    <xsl:variable name="testVersion" select="@version"></xsl:variable>
    <xsl:variable name="separator" select="'.'"></xsl:variable>
    
    
    <xsl:if test="string-length($testVersion) > 0">
    
      <xsl:variable name="firstnumber"     select="substring-before($testVersion, $separator)"/>
      <xsl:variable name="after-separator" select="substring-after($testVersion, $separator)"/>       
      <xsl:variable name="secondnumber"    select="substring-before($after-separator, $separator)"/>        
    
      <xsl:variable name="outputvalue">
        <xsl:text>[</xsl:text>
        <xsl:value-of select="$firstnumber"></xsl:value-of>
        <xsl:text>.</xsl:text>
        <xsl:value-of select="$secondnumber"></xsl:value-of>
        <xsl:text>,</xsl:text>
        <xsl:value-of select="$firstnumber"></xsl:value-of>
        <xsl:text>.</xsl:text>
        <xsl:value-of select="number($secondnumber)+1"></xsl:value-of>
        <xsl:text>)</xsl:text>
      </xsl:variable>
    
      <xsl:value-of select="$outputvalue"/>
    </xsl:if>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to read a XML file with java. File structure as below. <?xml
I have to parse a 1Gb XML file with a structure such as below
I have an xml file likes below. <?xml version=1.0 encoding=utf-8 ?> <Book> <Title>Title</Title> <Content>Content</Content>
I have a xml file as below: <?xml version=1.0 encoding=UTF-8 standalone=no?> <RULES> <RULE DESCRIPTION=
i have an xml file sitemap.xml as shown below ..i need to add one
I have a XML file with the structure as shown below: <x> <y/> <y/>
Let's suppose we have the XML file with the structure as follows. <?xml version=1.0
I have an xml file with the below structure: <connections> <connection> <serverName>serverName1</serverName> <dbName>dbName1</dbName> </connection>
I have an XML file that will be similar to the structure below: <?xml
I have a flat structured XML file as below: <rs> <r id=r1 lev=0/> <r

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.