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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:35:08+00:00 2026-05-29T20:35:08+00:00

I have the following xml structure (It is much longer and compicated in the

  • 0

I have the following xml structure (It is much longer and compicated in the real example)

<document>
    <node1>
       <child1/>
       <child2/>
       ...
  </node1>
  <anotherNode />
</document>

I want to create a template like

<xsl:template match="node1" mode="node1">
        <img alt="" src="{child1}" />
        ...
        ...

</xsl:template>

and to apply this template in another template like this

<xsl:template match="anotherNode">
    <xsl:apply-templates select="node1" mode="node1" />
</xsl:template>

If the node1 tag had parent that would be easy to do, but I can’t figure out how to match and apply template if it does not have a parent.

  • 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-29T20:35:12+00:00Added an answer on May 29, 2026 at 8:35 pm

    Use:

    <xsl:template match="anotherNode"> 
        <xsl:apply-templates select="/*/node1" mode="node1" /> 
    </xsl:template> 
    

    Or alternatively:

    <xsl:template match="anotherNode"> 
        <xsl:apply-templates select="../node1" mode="node1" /> 
    </xsl:template> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following xml structure and want to add it to a treeview.
Say I have this following XML structure: <?xml version=1.0 encoding=UTF-8?> <main> <parent> <child1>some value</child1>
I have to following XML document structure: <option_set id=1> <option>Yes</option> <option>No</option> <option>Maybe</option> </option_set> <question
I have following XML generated by serializing a boost::posix_time::ptime structure. I want to create
I have the following Xml structure: <sitemapindex xmlns=http://www.sitemaps.org/schemas/sitemap/0.9> <sitemap> <loc>http://www.example.com/</loc> <lastmod>2011-11-27T08:34:46+00:00</lastmod> </sitemap> <sitemap> <loc>http://www.example.com/123</loc>
I have the following XML structure: <?xml version=1.0 ?> <course xml:lang=nl> <body> <item id=787900813228567
I have the following sample XML structure: <SavingAccounts> <SavingAccount> <ServiceOnline>yes</ServiceOnline> <ServiceViaPhone>no</ServiceViaPhone> </SavingAccount> <SavingAccount> <ServiceOnline>no</ServiceOnline>
I have the following XML source structure: <turnovers> <turnover repid=1 amount=500 rate=0.1/> <turnover repid=5
I have following object structure, deseralized from XML (WS): <ns2:Category> <ns2:CategoryId>800003</ns2:CategoryId> <ns2:CategoryName>Name1</ns2:CategoryName> <ns2:Categories> <ns2:Category>
If i have the following directory structure: Project1/bin/debug Project2/xml/file.xml I am trying to refer

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.