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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:29:31+00:00 2026-06-11T11:29:31+00:00

I think this isn’t possible but would like to have a definitive answer. XML:

  • 0

I think this isn’t possible but would like to have a definitive answer.

XML:

  <agentlang>French</agentlang>
  ...
  <books>
    <book>
      <title>My Book</title>
      <author>Me</author>
    </book>
    <book>
      <title>XPath 101</title>
      <author>You</author>
  </book>
  ...
 </books>
 .....
 <translations>
    <translation English="title" French="titre" German="Titel" />
    <translation English="author" French="auteur" German="Autor" />
 </translations>

then in the XSL there is a simple transform of the main books info, but I want the headers to be translated according to the translation xml- something like this will work:

<xsl:value-of select="//translation[@English='title']/@French"/>
<xsl:value-of select="//translation[@English='Author']/@French"/>

But I want to replace the attribute @French with the agentlang value from the XML

I’m using MSXML / XSLT 1.0

Is there any way this can be done?

  • 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-11T11:29:32+00:00Added an answer on June 11, 2026 at 11:29 am

    Yes, you can use a local-name() to find an element or attribute with a given dynamic value. I’ve stored the lookup value in a xsl:variable:

    <xsl:variable name="lang" select="//agentlang/text()" />
    <xsl:value-of select="//translation[@English='title']/@*[local-name()=$lang]" />
    

    If namespaces are involved, it is good practice to also include a check for namespace-uri()=..., as of course there may be two elements with the same name, but in different namespaces.

    Edit

    In hindsight, use of a variable may make the transform easier to read / maintain, but isn’t essential – this can be done directly as well:

    <xsl:value-of select="//translation[@English='title']/@*[local-name()=//agentlang]" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched and searched for this but I think my terminology isn't correct
First, housekeeping: A quick review makes me think this isn't a duplicate but would
i know that there isn't code inside my question, but i think this is
Hopefully this question isn't as subjective as I think it may be. I have
I think this could be a very easy question for you. But I have
I think this isn't supposed to happen, but I can't find why this isn't
I am using C# 2.0, and I can't help but think this isn't the
all. I'd think that this could be answered easily, but it isn't. As long
I don't think this is possible but here goes... I want to add method
(I think this is a pretty basic question on OOP, but unfortunately I wasn't

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.