473,657 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xsl:template - access attribute from one level up

If I have the following XML:

<xml>
<levelone>
<leveltwo attribute="valu e">
<levelthree attribute2="val ue2">
Some Value
</levelthree>
</leveltwo>
</levelone>
</xml>

And the following XSL:

<xsl:template match="ns1:leve lthree">
.....
</xsl:template>

How would I refer to the the value of '@attribute' from leveltwo?

I have tried a couple of different ways, but without a lot of luck!

Many thanks

Darren

May 24 '06 #1
2 2053


daz_oldham wrote:

<xml>
<levelone>
<leveltwo attribute="valu e">
<levelthree attribute2="val ue2">
Some Value
</levelthree>
</leveltwo>
</levelone>
</xml>

And the following XSL:

<xsl:template match="ns1:leve lthree">
.....
</xsl:template>

How would I refer to the the value of '@attribute' from leveltwo?


../@attribute

--

Martin Honnen
http://JavaScript.FAQTs.com/
May 24 '06 #2
Thanks Martin - I missed out the fact that I am in fact going up two
levels and not one.

You don't have to call me an idiot, I already know ;)

Many thanks

Darren

May 24 '06 #3

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

Similar topics

7
1760
by: Kofi Sarfo | last post by:
Wondering what I'd use to evaluate the following to return 'Easy' <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="Answers.xsl"?> <answers> <answer> <code>A</code> <method>Easy</method> </answer> <answer>
3
3207
by: Ray Tayek | last post by:
hi, trying to use an xslt to make an xslt. trying something like: <?xml version="1.0" encoding="UTF-8"?> <?xmlspysamplexml H:\java\projects\spy1\spy\inputDocumentMap.xml?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/inputDocumentMap"> <xsl:element name="xsl:template" match="/inputDocument">...
1
1425
by: Vijay singh | last post by:
Hi wonder if anybody can clear by doubt XML file : <score id="1"> <film>A Little Princess</film> <composer>Patrick Doyle</composer>
5
1447
by: KJ | last post by:
I would like to know if there is a tool for download or purchase that will generate a skeleton xslt document, inserting all the xsl:template's matching each element specified in any given xsd. Does anyone know of one? Thanks, KJ
3
2263
by: Steve | last post by:
Is there any way of specifying the startMode when using the xslTransform class? We are updating code which used msxml to the system.xml classes but can find no way to specify the startMode. We use this so that we can specify different templates to be used by the same xml node. Know that we could use global params, but would rather not have to update all teh stylesheets and any code that uses msxml and the same stylesheets.
2
1377
by: tentstitcher | last post by:
Hello: I am stumped on what I belive to be a namespace issue. The XSL, source XML, and result XML are included below. The problem is that the template to match "getBalances" is never invoked by the apply-templates. If I remove the default namespace in the source XML's getBalance element, the problem goes away and the template is matched. I spent several hours searching the newsgroups but in vain. Any help would be appreciated.
2
1083
by: eric.goforth | last post by:
Hello, What happens if you call an xsl template if you call it without setting the values of all it's parameters, I assume that the parameters will be either null or an empty string and the following code will handle it: <xsl:if test="string-length($sValue) &gt; 0"> <xsl:attribute name="VALUE"><xsl:value-of select="$sValue"/></xsl:attribute> </xsl:if>
4
1743
by: festo | last post by:
Hi guys, I need to print a different footer depending on the template being printed. How do I test for the current template being processed in XSLT? Thanks, fes
5
3900
by: John Gordon | last post by:
My XSLT files have many occurrences of this general pattern: <a> <xsl:attribute name="href"> <xsl:value-of select="xyz" /> </xsl:attribute> </a> When I execute an XSL transform, the resulting HTML looks like this:
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
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...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
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...
1
2743
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
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
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.