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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:06:28+00:00 2026-05-30T09:06:28+00:00

I’m trying to transform the following XML.. <?xml version=1.0 encoding=utf-16?><Member TextRank=unknown FullName=My Name ..etc..

  • 0

I’m trying to transform the following XML..

<?xml version="1.0" encoding="utf-16"?><Member TextRank="unknown" FullName="My Name" ..etc.. />

Into something like the following,

<div class="member">
    <span class="label">
        Text Rank (note: i want to override the labels in the xslt)
    </div>
    <span class="value">
        unknown
    </span>
    <span class="label">
        Full Name
    </div>
    <span class="value">
        My Name
    </span>
    ..etc..
</div>

How if possible could I do this using xslt?

  • 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-05-30T09:06:29+00:00Added an answer on May 30, 2026 at 9:06 am

    Here’s a different approach, that does away for the need for the xsl:choose element. Instead, you could take advantage of the matching templates to have specific templates for the cases of attributes who names you want to override, and a generic template for other case.

    To avoid repetition of code, you could also make the generic template a named template, with a parameter to override the name

    <xsl:template match="@*" name="attribute">
       <xsl:param name="label" select="local-name()" />
    

    So, the default for most attributes would be to use the attribute name, but the specific template for @FullName could then call this with a different name.

    <xsl:template match="@FullName">
       <xsl:call-template name="attribute">
          <xsl:with-param name="label" select="'Full Name'" />
       </xsl:call-template>
    </xsl:template>
    

    Here is the full XSLT:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       <xsl:output method="html" indent="yes"/>
    
       <xsl:template match="*">
          <div class="{local-name()}">
             <div> Title: </div>
             <xsl:apply-templates select="@*"/>
          </div>
       </xsl:template>
    
       <xsl:template match="@FullName">
          <xsl:call-template name="attribute">
             <xsl:with-param name="label" select="'Full Name'" />
          </xsl:call-template>
       </xsl:template>
    
       <xsl:template match="@*" name="attribute">
          <xsl:param name="label" select="local-name()" />
          <span class="label">
             <xsl:value-of select="concat($label, ' : ')"/>
          </span>
          <span class="value">
             <xsl:value-of select="."/>
          </span>
          <br/>
       </xsl:template>
    </xsl:stylesheet>
    

    When applied to the following XML:

    <Member TextRank="unknown" ID="12" FullName="My Name" Dob="01/01/1970" />
    

    The following is output:

    <div class="Member">
       <div> Title: </div>
       <span class="label">TextRank : </span>
       <span class="value">unknown</span>
       <br>
       <span class="label">ID : </span>
       <span class="value">12</span>
       <br>
       <span class="label">Full Name : </span>
       <span class="value">My Name</span>
       <br>
       <span class="label">Dob : </span>
       <span class="value">01/01/1970</span>
       <br>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.