473,597 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Context

The following question is about XPath and context, as I am not sure I'm
grasping the concept entirely and this is causing me some problems while
working on my XSL transformation.

I have checked the XPath specification and am somewhat familiar with the
different addressing mechanisms. What confuses me is the context when
using templates and various (nested) <xsl:for-each>, <xsl:if> and
<xsl:when> expressions.

For example, say I have a named template where test-param is the value
of a certain node.

<xsl:template name="test_temp ">
<xsl:param name="test_para m"/>
...
...
<xsl:for-each select="[some other node]">

<!--here, I assume the context is that of [some other node], and not the
node represented by test_param?-->

<xsl:if test="[yet another node]">

<!--What about the context here, is it that of [yet another node]?-->

</xsl:if>
</xsl:for-each>

<!--And here, am I back to the original context, the one defined by the
test_param?-->

</xsl:template>

And so on, and so forth...
To put it briefly: Does every expression that evaluates a set of nodes
change the context to that particular set, thus enabling me to use ./
while referring to attributes or other subnodes of that node?

-----------------
Eliza Zadura
Trainee-Developer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
2 2363
Hi Eliza,
For example, say I have a named template where test-param is the value
of a certain node.

<xsl:template name="test_temp ">
<xsl:param name="test_para m"/>
^^^^^ the context here will be whatever the context node was at the point of
the <xsl:call-template>. Parameters have no effect on the context. ..
..
<xsl:for-each select="[some other node]">

<!--here, I assume the context is that of [some other node], and not the
node represented by test_param?-->
^^^^^ yes, the context node will be the [some other node]
<xsl:if test="[yet another node]">

<!--What about the context here, is it that of [yet another node]?-->

</xsl:if>
</xsl:for-each>

<!--And here, am I back to the original context, the one defined by the
test_param?-->
^^^^^ No, because the context was never the node(s) in the $test_param - the
context will revert to the context node at the point of the
<xsl:call-template>
</xsl:template>

Hope this helps
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator
"Eliza Zadura" <el**********@s ync.se> wrote in message
news:3f******** *************** @news.frii.net. .. The following question is about XPath and context, as I am not sure I'm
grasping the concept entirely and this is causing me some problems while
working on my XSL transformation.

I have checked the XPath specification and am somewhat familiar with the
different addressing mechanisms. What confuses me is the context when
using templates and various (nested) <xsl:for-each>, <xsl:if> and
<xsl:when> expressions.

For example, say I have a named template where test-param is the value
of a certain node.

<xsl:template name="test_temp ">
<xsl:param name="test_para m"/>
..
..
<xsl:for-each select="[some other node]">

<!--here, I assume the context is that of [some other node], and not the
node represented by test_param?-->

<xsl:if test="[yet another node]">

<!--What about the context here, is it that of [yet another node]?-->

</xsl:if>
</xsl:for-each>

<!--And here, am I back to the original context, the one defined by the
test_param?-->

</xsl:template>

And so on, and so forth...
To put it briefly: Does every expression that evaluates a set of nodes
change the context to that particular set, thus enabling me to use ./
while referring to attributes or other subnodes of that node?

-----------------
Eliza Zadura
Trainee-Developer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #2
Thank you for your reply. That is what I thought, but I wanted it
confirmed.

What about if I have nested for loops? Will the context of the inner
loop be that of the inner select?

I'm having to do quite horrible loops and conditions to accomplish what
I need, and find all this a bit confusing...

-----------------
Eliza Zadura
Trainee-Developer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
10271
by: SPG | last post by:
Hi, I am relatively new to TOMCAT, and am trying to deploy a web app using it. I have a domain name that I want to use to access my web app directly. By default, I deploy my WAR, and it deploys to webapps/myApp. To access this I have to use a url like http://mydomain.com/myApp?someparam=1 What I want to do is use this: http://mydomain.com?someparam=1
4
3034
by: Mohit Gupta | last post by:
Hi all, Lately I have been working on an application in VB .net CF for Pocket PC device. I have a small question about Context Menu. When I try to close the window after context menu is poped up, the window does not closes until I click on the window. Below is the code. Hopefully, you can help me out.
5
3682
by: Nadav | last post by:
Hi, I am using FileStream's Async API: BeginRead/EndRead, upon completion callback execution I use the read data and call EndRead, Taking that in mind, I Wonder... does calling EndRead will cause a context switch? What is the kernel object used for blocking EndRead calls? Event and mutex cause a context switch even when the object is signaled and no wait is needed, usage of critical section prevent this switch from happening... what is the...
5
5482
by: Dean L. Howen | last post by:
Dear friends, Could we determine when context menu should appear?
8
10083
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for a text box has 6 items, undo, cut, copy, paste, delete and select all. I would like to add one additional paste menu that opens a new sub menu with several optional text items that could be pasted. The items would be populated by my program but...
2
1702
by: dave | last post by:
This little problem is driving me nuts!! On my webform page I create 2 variables.. Protected p_dml As String = "I" Public Const mwv_id As Integer = 0 ' originally had mwv_id as Protected
1
6329
by: goRide | last post by:
Hi, I'm looking of a way (preferred - a ready class or dll) to customize the context menu. many application has more controls inside the context menu (like textbox, sliders, checkbox, panel etc'). is there a way making this without writing my own context menu (meaning, popup form or something) ? Please don't post commercial products to this topic thanks.
4
4683
by: Andrus | last post by:
For winforms application with multiple related forms it is reasonable to create Linq database context object in start of application. Context object is released only when application exits. So connection to database may remain open for all application run time. For such a long time, some routers close connection. This causes Connection is broken error in application. How to fix this ?
4
11941
by: AAaron123 | last post by:
trying to understand the below shown code. After this is run the browser opens a file-save dialog box for saving the file. I wonder how it knows I want the file saved? But more important, the dialog box has as the default file name the name of this ashx file. I'd like to make that name more meaningfull but don't know how it gets set. I'm looking for a Response.Write but don't find one. Maybe that why the
0
7884
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5423
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3880
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3921
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2394
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1493
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1229
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.