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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:02:00+00:00 2026-06-07T06:02:00+00:00

I have a query in the xml and xslt The below is the Input

  • 0

I have a query in the xml and xslt

The below is the Input XML

<?xml version="1.0" encoding="UTF-8"?>    
<Employer>
<Employees>
    <EmployeesDetails>van ind 26%</EmployeesDetails>
</Employees>    
<Employees>
    <EmployeesDetails>van ind</EmployeesDetails>
</Employees>    

The below is my output file

<?xml version="1.0" encoding="UTF-8"?>
<Employer>
<Employees>
    <Names>van</Names>
    <Location>ind</Location>                
    <Weather>26</Weather>
</Employees>
<Employees>
    <Names>van</Names>
    <Location>ind</Location>
    <Weather>100</Weather>
</Employees>

In XSLT I need to check(XSL:IF)whether weather element is available or not from Input XML if available(26%) I have to remove % using XSLT then output will be 26. If there Is no element in XML(weather) It has to create by default 100.

Can we able to do this in XSLT is that possible.

Can anyone help me out here please

  • 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-07T06:02:03+00:00Added an answer on June 7, 2026 at 6:02 am

    Please have a look at the following XSLT.

    <?xml version="1.0" encoding="utf-16"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output omit-xml-declaration="yes" indent="yes" />
    
        <xsl:template match="@*|node()">
            <xsl:copy>
                <xsl:apply-templates />
            </xsl:copy>
        </xsl:template>
    
        <xsl:template match="EmployeesDetails">
            <xsl:variable name="Detail" select="concat(., ' ')" />
            <xsl:variable name="Names" select="substring-before($Detail, ' ')" />
            <xsl:variable name="Location" select="substring-before(substring-after($Detail, concat($Names, ' ')), ' ')" />
            <xsl:variable name="Weather" select="substring-before(substring-after($Detail, concat($Location, ' ')), '% ')" />
            <Names>
                <xsl:value-of select="$Names" />
            </Names>
            <Location>
                <xsl:value-of select="$Location" />
            </Location>
            <Weather>
                <xsl:choose>
                    <xsl:when test="string-length($Weather) &gt; 0">
                        <xsl:value-of select="$Weather" />
                    </xsl:when>
                    <xsl:otherwise>100</xsl:otherwise>
                </xsl:choose>
            </Weather>
        </xsl:template>
    </xsl:stylesheet>
    

    http://www.xmlplayground.com/Gg5F3z

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

Sidebar

Related Questions

I have an xml in following form: <?xml version=1.0 encoding=UTF-8?> <query> <queryParams name=accountID>Star TV</queryParams>
In the linq to xml query below, I have 2 properties that are a
I have trouble working with xml query. Below is the xml document. All I
I have an odd XML document that I have to query. Its from the
I have a pretty simple Linq to XML query: var q = from c
I have the following XML LINQ query from my XDocument. var totals = (from
I have a (disconnected) typed Dataset in an XML, which I query in LINQ:
I'm having an issue getting a LINQ query to work. I have this XML:
I have an xml query which should be xsd validated ...(impossible ??) Unfortunately the
I have a Linq-2-XML query that will not work if a google sitemap that

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.