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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:57:49+00:00 2026-06-07T04:57:49+00:00

I am working on XML & XSLT dynamic value has to generate. My XmL

  • 0

I am working on XML & XSLT dynamic value has to generate.

My XmL

<query>
     <one>testing1</one>
     <one>testing1</one>
</query>

My Output Xml

<query>
     <one>testing1</one>
     <one>testing1</one>
     <sample>100</sample>
</query>

XSLT
I need to check(XSL:IF)whether sample element is available or not from Input XML if available 10% I have to remove % using XSLT then output will be 10. If there Is no element in XML(Sample) 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

Regards
M

  • 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-07T04:57:50+00:00Added an answer on June 7, 2026 at 4:57 am

    How about this …

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
    
    <xsl:template match="@*|node()">
       <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
       </xsl:copy>
    </xsl:template>
    
    <xsl:template match="/*[not(//sample)]">
       <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
         <sample>100</sample> 
       </xsl:copy>
    </xsl:template>
    
    <xsl:template match="sample">
       <xsl:copy>
        <xsl:apply-templates select="@*"/>
        <xsl:value-of select="translate(.,'%','')"/>
        <xsl:apply-templates select="*"/>
       </xsl:copy>
    </xsl:template>
    
    </xsl:stylesheet>
    

    Explanation

    The second template adds the sample node, if it was not present.
    The third template removes any percentage signs from existing samples.

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

Sidebar

Related Questions

I'm working with an xml document in C# that has multiple (100+) points of
I'm way new to working with XML but just had a need dropped in
The XML schema I'm working with has specific character lengths for strings. So I
guys, recursion with grouping is not working. I am using XSLT 1.0. I need
I am working with a CV project using XML for storing CVs, using XSLT
The following is the sample XML structure I'm working on: <command name=test> <parameter index=2>4000</parameter>
So I've been working on some XSLT to modify YouTube's RSS XML, and of
my question is the following, which is the best way of working XML (kml)
I am working with XML files that are generated by a digital video camera.
I'm working with XML data from an application where we get XML like this:

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.