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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:33:26+00:00 2026-06-07T22:33:26+00:00

My input.xml is as follows: <root> <Property> <info> <Name>A</Name> <Value>1000</Value> </info> <info> <Name>B</Name> <Value>2000</Value>

  • 0

My input.xml is as follows:

    <root>
      <Property>
        <info>
          <Name>A</Name>
          <Value>1000</Value>
        </info>
        <info>
          <Name>B</Name>
          <Value>2000</Value>
        </info>  
        <info>
          <Name>C</Name>
          <Value>3000</Value>
        </info>  
      </Property>
    </root>

So here when I say –
<xsl:apply-templates select="//Property/info"> How the tree will be? Can I think it as shown below?

      <Property>
        <info>
          <Name>A</Name>
          <Value>1000</Value>
        </info>
        <info>
          <Name>B</Name>
          <Value>2000</Value>
        </info>  
        <info>
          <Name>C</Name>
          <Value>3000</Value>
        </info>  
      </Property>

and when matching template can I take the Property element as root element in the tree? (I am thinking yes as I executed it and thinking that seperate tree will be created somewhere in memory – Is that true? (explanation please))

<xsl:template match="Property/info"/>

Here my actual Q is- are the templates be applied to the tree in buffer (taking it as main tree) or to the original source tree?

a) If things are calculated/applied on buffered tree, we should not be able to retrieve the root element right when I say

<xsl:copy-of select="../../*"/>

because buffered tree doesn’t have root element and processor doesn’t know about root element. [But how things are working actually?]

b) If templates are applied to the original source tree then

<xsl:template match="Property/info"/>

should not work right? (as we should give in this way:

<xsl:template match="root/Property/info"/>

or

<xsl:template match="//Property/info"/>

but without mentioning as above its working. How is it possible?)

  • 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-07T22:33:28+00:00Added an answer on June 7, 2026 at 10:33 pm

    There are two separate questions here:

    1) How are template match patterns matched against parts of the source document tree? and

    2) What is the context node when a particular template is applied?

    Template match patterns are not the same as XPath expressions, even though they look similar. In particular they do not assume any current context node. “Property/info” matches any info element anywhere in the tree whose parent is a Property element. Even though this match pattern looks the same as the XPath expression in select="Property/info", they are quite different; the latter will select only info elements that are children of Property elements that are children of the context node. The match pattern does not have the latter restriction, nor could it, because the concept of a context node does not enter into the specification for matching match patterns. (I guess it would be more accurate to say that for match patterns, the initial context node is unspecified; it could be any node that has [explicitly or implicitly] been selected by <xsl:apply-templates>.)

    Once a particular template is selected (via matching) to be applied to a particular node, that node becomes the context node as the contents of the selected template are evaluated. (The XSLT processor does not (conceptually) copy part of the tree into a buffer; the context node is a node in the original source document.) So yes, you can select “../../*” because you’re starting from a context node at /root/Property/info.

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

Sidebar

Related Questions

My input XML consists of the following, <root> <entry> <type>U</type> <value>111</value> </entry> <entry> <type>X</type>
I have the following input XML: <root age=1> <description>some text</description> <section> <item name=a> <uuid>1</uuid>
I have an input xml as follows, <?xml version=1.0 encoding=utf-8 ?> <?xml-stylesheet type=text/xsl href=cdcatalog.xsl?>
My input XML consists of the following, <root> <entry> <type>U</type> <value>111</value> </entry> <entry> <type>X</type>
My sample input XML is: <root> <a> <b>item</b> <b>item1</b> <b>item2</b> <b>item3</b> <b>item4</b> </a> </root>
This is my input xml: <root> <node1/> <node2/> <node3/> <node4/> <othertags/> </root> The output
I am looking to transform a input xml given below <profile name=default> <color id=forecolor
I am having a xml file as input to the xsl file. When i
My input XML is as follows: <SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/> <SOAP-ENV:Header> <ns0:PartyInfo xmlns:ns0=http://www.google.com/> <name xmlns=>John</name> </ns0:PartyInfo>
I have an input xml and corresponding java classes as the following. <Address> <name>name</name>

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.