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

  • Home
  • SEARCH
  • 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 8257861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:20:43+00:00 2026-06-08T02:20:43+00:00

Apologies if this a seen as a gimme the codez type question but my

  • 0

Apologies if this a seen as a “gimme the codez” type question but my xpath skills were not up to scratch on this. It is in my opinion generic enough to be of interest for more people

Given this multilingual XML file below. We need to substitue the blank Dutch entries with their English sibling element.

Input:

<Testing> 
  <T4 t="dutch"></T4> 
  <T4 t="english">Testing Software</T4> 
  <T4 t="french"/> 
  <T4 t="italian"/> 
 </Testing> 
 <P> 
  <T1 t="dutch"></T1> 
  <T1 t="english">Testing Phase. </T1> 
  <T1 t="french"></T1> 
  <T1 t="italian"></T1> 
 </P> 

output:

<Testing> 
  <T4 t="dutch">
    <trans>Testing Software</trans>
  </T4> 
  <T4 t="english">Testing Software</T4> 
  <T4 t="french"/> 
  <T4 t="italian"/> 
</Testing> 
<P> 
  <T1 t="dutch"><trans>Testing Phase.</trans></T1> 
  <T1 t="english">Testing Phase. </T1> 
  <T1 t="french"></T1> 
  <T1 t="italian"></T1> 
</P>
  • 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-08T02:20:46+00:00Added an answer on June 8, 2026 at 2:20 am

    This should work…

    XML Input (wrapped in input to be well-formed)

    <input>
        <Testing> 
            <T4 t="dutch"></T4> 
            <T4 t="english">Testing Software</T4> 
            <T4 t="french"/> 
            <T4 t="italian"/> 
        </Testing> 
        <P> 
            <T1 t="dutch"></T1> 
            <T1 t="english">Testing Phase. </T1> 
            <T1 t="french"></T1> 
            <T1 t="italian"></T1> 
        </P> 
    </input>
    

    XSLT 1.0

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output indent="yes"/>
        <xsl:strip-space elements="*"/>
    
        <xsl:template match="@*|node()">
            <xsl:copy>
                <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
        </xsl:template>
    
        <xsl:template match="*[@t='dutch'][not(node())]">
            <xsl:copy>
                <xsl:apply-templates select="@*"/>
                <trans><xsl:value-of select="normalize-space(../*[@t='english'])"/></trans>
            </xsl:copy>
        </xsl:template>
    
    </xsl:stylesheet>
    

    Output

    <input>
       <Testing>
          <T4 t="dutch">
             <trans>Testing Software</trans>
          </T4>
          <T4 t="english">Testing Software</T4>
          <T4 t="french"/>
          <T4 t="italian"/>
       </Testing>
       <P>
          <T1 t="dutch">
             <trans>Testing Phase.</trans>
          </T1>
          <T1 t="english">Testing Phase. </T1>
          <T1 t="french"/>
          <T1 t="italian"/>
       </P>
    </input>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apologies if this is a slightly noob question, but looking to clarify my thoughts
Apologies in advance but I have never seen this error before and don't know
Now I've seen some questions like this, but it's not exactly what I want
I have seen this question answered in reference to Bash, but can't find one
Apologies if this question has been answered before. Though the answers I've seen look
Apologies if this has been asked already. I've seen answers regarding static SQLs, but
First of all, apologize because I have seen some posts about this, but I
Apologies if this doesn't make sense, i'm not much of an experienced programmer. Consider
Apologies if this is answered elsewhere; couldn't find enough information to convince myself of
Apologies if this is too ignorant a question or has been asked before. A

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.