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 8101493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:59:35+00:00 2026-06-05T22:59:35+00:00

Sorry for the dumb question, but string handling in xsl 1.0 is not one

  • 0

Sorry for the dumb question, but string handling in xsl 1.0 is not one of my strong points.
I’m looking for a way of extracting a string held between pseudo html tags.
EG.

<xsl:variable name="test">
    This is a string <link>http://www.stackoverflow.com</link> and some more stuff here
</xsl:variable>

The idea being to end up with 2 further variables that would contain.

var1 = http://www.stackoverflow.com
and
var2 = This is a string and some more stuff here

Like I say, sorry it’s a dim question. Thanks.

  • 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-05T22:59:36+00:00Added an answer on June 5, 2026 at 10:59 pm

    Here is how to do this:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:variable name="test">
      This is a string <link>http://www.stackoverflow.com</link> and some more stuff here
     </xsl:variable>
    
     <xsl:variable name="vTestNodeset" select="document('')/*/xsl:variable[@name='test']"/>
    
     <xsl:variable name="var1" select="string($vTestNodeset/link)"/>
    
     <xsl:variable name="var2">
      <xsl:copy-of select="$vTestNodeset/text()"/>
     </xsl:variable>
    
     <xsl:template match="/">
         "<xsl:value-of select="$var1"/>"
    ============    
         "<xsl:value-of select="$var2"/>"
    ============    
         "<xsl:value-of select="normalize-space($var2)"/>"
     </xsl:template>
    </xsl:stylesheet>
    

    When this transformation is applied on any XML document (not used), the wanted result is produced:

         "http://www.stackoverflow.com"
    ============    
         "
      This is a string  and some more stuff here
     "
    ============    
         "This is a string and some more stuff here"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for maybe dumb question, but i have HUGE problem with one case when
Sorry for the dumb question, but I'am not able to figure out my typo:
Sorry about the dumb question, but is there a way to draw a character
Sorry if this is a dumb question but im creating a filter class that
Sorry for the dumb question, but I'm working with Qt and C++ for the
Sorry if this is a dumb question, but it is possible to store, and
Sorry if it is a dumb question, but the issue is quite straight forward.
First of all sorry if it's a dumb question (and surely it is), but
first of all, sorry if that question is dumb but I´m a total newbie
Not a full-time jQuery nor Javascript dev so sorry if dumb question. I think

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.