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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:35:11+00:00 2026-06-04T09:35:11+00:00

I have following source xml <forms> <x> <y> <x-component select=foobar /> </y> </x> <component

  • 0

I have following source xml

<forms>
  <x>
    <y>
        <x-component select="foobar" />
    </y>
  </x>


  <component name="foobar">
    <some>
        <component>
            <value>text</value>
        </component>
    </some>
  </component>
</forms>

I’m trying to transform it to following:

<?xml version="1.0" encoding="UTF-8"?>
<forms>
    <x>
        <y>
            <component name="foobar">
                <some>
                    <component>
                        <value>text</value>
                    </component>
                </some>
            </component>
        </y>
    </x>
</forms>

My xsl file is

<?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes"/>

    <xsl:template match="x-component">
        <yoba>
            <xsl:attribute name="z">
                <xsl:value-of select="@select"/>
            </xsl:attribute>
            <xsl:apply-templates select="/forms/component[@name=@select]/*"  />
        </yoba>
    </xsl:template>

    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="/">
        <xsl:apply-templates select="*"/>
    </xsl:template>
</xsl:stylesheet>

How can I pass value of the select attribute of the current node for this line (instead of PLACEHOLDER):

<xsl:apply-templates select="/forms/component[@name=<PLACEHOLDER>]/*"  />
  • 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-04T09:35:13+00:00Added an answer on June 4, 2026 at 9:35 am

    Use current()/@select. Or better define a key <xsl:key name="k1" match="component" use="@name"/> and the do <xsl:apply-templates select="key('k1', @select)"/>.

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

Sidebar

Related Questions

I have the following simplified XML source: <?xml version=1.0 encoding=UTF-8?> <MVKE> <item> <MANDT>025</MANDT> <MATNR>000000000000000551</MATNR>
I have the following: <xs:attribute name=CarTitleID type=xs:long use=optional /> In my source XML I
I have the following XML: <?xml version=1.0?> <?xml-stylesheet type=text/xsl href=http://www.test.com/AuditTrail.xsl?> and XSL: <?xml version=1.0
lets say i have the following XML <?xml version=1.0 encoding=utf-8?> <names> <name first=John last=Doe/>
I have the following build.xml and build.properties files: build.xml <?xml version=1.0 encoding=UTF-8?> <project name=CoolProducts
I have the following XML source structure: <turnovers> <turnover repid=1 amount=500 rate=0.1/> <turnover repid=5
So I have the following code: <redirect:write select=concat('..\\folder\\,string(filename),'.xml')> Where filename is a tag in
I have the following simplified XML: <?xml version="1.0" encoding="UTF-8"?> <ExportData> <Rows> <R> <companyCodestringtrue>101</companyCodestringtrue> <transactionQualifierstring>Sales</transactionQualifierstring>
I have the following XML: <?xml version=1.0 encoding=utf-8 ?> <ApplicationSettingCategories> <Category>Cat1</Category> <Category>Cat2</Category> <Category>Cat3</Category> <Category>Cat4</Category>
I have the following XML code <class name=ContentStreamer> <method name=sendAudio> <criteria>medium</criteria> </method> <method name=sendVideo>

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.