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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:33:00+00:00 2026-06-13T11:33:00+00:00

Given an XML like this: <a id=1> <b> <code>42</code> </b> </a> And the target

  • 0

Given an XML like this:

<a id="1">
  <b>
    <code>42</code>
  </b>
</a>

And the target being:

<request>
  <aId>1</aId>
  <bCode>42</bCode>
</request>

I can reach that using this XSLT:

<template match="/">
  <element name="request">
    <apply-templates/>
  </element>
</template>

<template match="a">
  <element name="aId"><value-of select="@id"/></element>
  <apply-templates/>
</template>

<template match="b/code">
  <element name="bCode"><value-of select="."/></element>
</template>

However, this also works if I swap <apply-templates/> with <next-match/>. Any advice on which to use when, when they both seem to work fine? Does next-match have additional effects which can mess things up if I add more stuff later for example?

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

    Well in that case your use of next-match relies on the built-in element template doing apply-templates (see http://www.w3.org/TR/xslt20/#built-in-rule). And once you added a template for elements e.g.

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

    the next-match would no longer use the built-in template which does nothing but apply-templates but would choose above template which adds result nodes.

    So for your code I would continue to use apply-templates.

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

Sidebar

Related Questions

given an xml string like this: <some><nested><xml>value</xml></nested></some> what's the best option (using ruby) to
Given a document like this: <html xmlns=http://www.w3.org/1999/xhtml xml:lang=de> <body> ... </body> How can I
Given an XML document like this: <!DOCTYPE doc SYSTEM 'http://www.blabla.com/mydoc.dtd'> <author>john</author> <doc> <title>&title;</title> </doc>
Given an XML structure like this: <garage> <car>Firebird</car> <car>Altima</car> <car>Prius</car> </garage> I want to
Given an xml structure like this <gesmes:Envelope> <gesmes:subject>Reference rates</gesmes:subject> <gesmes:Sender> <gesmes:name>European Central Bank</gesmes:name> </gesmes:Sender>
Basically I have an XML file that looks like this: <?xml version=1.0 encoding=UTF-8?> <data>
Given paths like this: C:\Temp\SomeDirectory\*.xml I'd like to be able to distinguish the *.xml
I have some C# code that walks XML schemata using the Xml.Schema classes from
So I have an xml file that is formatted something like this <TopXmlTree> <IndentedItem1>
I am using XSLT 1.0 Suppose I have an xml that has certain num

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.