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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:01:08+00:00 2026-06-10T03:01:08+00:00

I have a complex adress string, or rather different possible formats, which I need

  • 0

I have a complex adress string, or rather different possible formats, which I need to split into road name, house number, floor, position (left,right,middel door) or door/room number

I have managed to do all apart from the last bit, with the pseudo “contains”:

<xsl:choose>
                <xsl:when test="contains(@addressFarLeft, ANY_NUMERIC_VALUE_ANYWHERE)">
                  <door>NUMERICVALUE</door>
                </xsl:when>
                <xsl:otherwise></xsl:otherwise>
              </xsl:choose>

Im pretty sure I cant just use some form of contains, but what then?

Value is set dynamically, but here are a few possible values:

<xsl:variable name="addressFarLeftValue">.th.</xsl:variable> =>
no numeric value, do nothing

<xsl:variable name="addressFarLeftValue">.1.</xsl:variable> =>
   produce:  <door>1</door>

<xsl:variable name="addressFarLeftValue">, . tv </xsl:variable> =>
no numeric value, do nothing

<xsl:variable name="addressFarLeftValue">,th, 4.</xsl:variable> =>
   produce:   <door>1</door>

Any suggestions?

  • 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-10T03:01:09+00:00Added an answer on June 10, 2026 at 3:01 am

    If you want to test whether a string contains a numeric value, one approach could be to use the ‘translate’ function to remove all numeric digits from the string, and if the resultant string doesn’t match the initial string, you know it must have contained a number. If the string doesn’t change, then it didn’t.

    <xsl:choose>
      <xsl:when test="translate($addressFarLeft, '1234567890', '') != $addressFarLeft">
        <door>1</door>
      </xsl:when>
      <xsl:otherwise/>
    

    So, <xsl:variable name="addressFarLeftValue">.1.</xsl:variable> outputs <door>1</door>, but <xsl:variable name="addressFarLeftValue">.th.</xsl:variable> doesn’t output anything.

    IF you wanted to extract the actual number, then assuming there was only one occurence of a number in the string, you could do this…

    <xsl:value-of 
       select="translate(
          @addressFarLeft, 
          translate(@addressFarLeft, '1234567890', ''), 
          '')" />
    

    So, <xsl:variable name="addressFarLeftValue">,th, 42.</xsl:variable> outputs 42

    If you had multiple numbers present, such as ,th, 42, ab, 1 this approach would fail though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some complex regular expressions which I need to comment for readability and
I am using WCF and REST, and I have complex types, which are working
I have a rather complex query that pretty much mimics a test query I
I have a complex object which has references to other objects, I am trying
I have a Customer model with two complex properties InternalAddress and PublicAddress which are
In my Spring 3.1.2.RELEASE application I have a complex form which requires the injection
Background: I have a User entity. The User entity looks like: private String name;
Suppose that you need to have a series of complex configuration for a series
I'm using VS2010 Beta 2, I have a Complex Type called Address with the
I have complex GUI application written in Python and wxPython. I want it to

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.