473,804 Members | 3,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xsl magic

I have an xml document containing properties for a group of hyperlinks.
Currently my xsl:stylesheet contains code as follows:
<a href="{concat(/links/@webroot,@url)} " title="My ToolTip Here">
<xsl:value-of select="@name"/></a>
I want to replace "My ToolTip Here" with the contents of the @description
element.
I have not been able to get the syntax right. Please help.

Jan 30 '06 #1
2 1109


Jerry Langley wrote:

Currently my xsl:stylesheet contains code as follows:
<a href="{concat(/links/@webroot,@url)} " title="My ToolTip Here">
<xsl:value-of select="@name"/></a>
I want to replace "My ToolTip Here" with the contents of the @description
element.

With an attribute value template you can put an XPath expression in
curly braces e.g.
<a title="{descrip tion}"
href="{concat(/links/@webroot,@url)} ">
if description is a child element of the context node or e.g.
<a title="{@descri ption}"
href="{concat(/links/@webroot,@url)} ">
if description is an attribute of the context node.
Your description "of the @description element" does not really make
sense, if you have an element with element name description then the
XPath is
description
only if it is an attribute and not an element you use
@description

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jan 31 '06 #2
cd~
A solution would be the <xsl:attribut e> element

it would look something like this

<a href=""><xsl:at tribute name="title"><x sl:value-of select="[path to
description attribute/element]"></xsl:attribute></a>

"Martin Honnen" <ma*******@yaho o.de> wrote in message
news:uv******** ******@TK2MSFTN GP09.phx.gbl...


Jerry Langley wrote:

Currently my xsl:stylesheet contains code as follows:
<a href="{concat(/links/@webroot,@url)} " title="My ToolTip Here">
<xsl:value-of select="@name"/></a>
I want to replace "My ToolTip Here" with the contents of the @description
element.

With an attribute value template you can put an XPath expression in curly
braces e.g.
<a title="{descrip tion}"
href="{concat(/links/@webroot,@url)} ">
if description is a child element of the context node or e.g.
<a title="{@descri ption}"
href="{concat(/links/@webroot,@url)} ">
if description is an attribute of the context node.
Your description "of the @description element" does not really make sense,
if you have an element with element name description then the XPath is
description
only if it is an attribute and not an element you use
@description

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Jan 31 '06 #3

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

Similar topics

4
4421
by: Dave Moore | last post by:
Hi All, Can anybody point me to a FAQ or similar that describes what all this stuff is about please?. I'm interfacing with a MySQL database if that's relavent. I've read a couple of books which refer to stripslahes and 'escaping' but nothing really explains what these terms are and why these are used. Why is 'escaping' (whatever that is) used?. What the hell is a magic quote?. How is it different from a non-magic one?. Regards, Dave
0
1718
by: Nilsson Mats | last post by:
Hi! I have an intresting problem for our programming community on Solaris. I want to develop an environment where: 1) The developers shouldn't need to bother about which Perl version to use. 2) When the Perl version is changed in a controlled manner, the change should be instant. 3) For developers whose scripts fails after a Perl version change, there should be a roll-back possibility. The infra structure in our department provides a...
19
5173
by: youpak2000 | last post by:
Are MAGIC numbers always bad? Using magic numbers (constant numbers) in programs are generally considered a bad programming practice, and it's recommended that to define constants in single, visible place in a header file. My question is that is there any situation where using magic numbers is not necessarily a bad thing? lets say that we want to initialize some private variables in a class using some constant default numbers, can we...
51
4478
by: Kuku | last post by:
What is the difference between a reference and a pointer?
0
1303
by: KronicDeth | last post by:
I have a package of python modules deployed on an NFS mount on my network that I use for sysadmin tools. Since some of the machines use different versions of python I've only put the .py files in the mounted share. However, I'm getting ImportError: Bad Magic Number when I try to load any of the modules from the mount point. All the discussions I can find say that a bad magic number should only occur with a mismatched interpreter and...
16
2612
by: per9000 | last post by:
Hi, I recently started working a lot more in python than I have done in the past. And I discovered something that totally removed the pretty pink clouds of beautifulness that had surrounded my previous python experiences: magic names (I felt almost as sad as when I discovered the strange pink worms that eat you in nethack, not to mention the mind flayers - I really hate them). I guess all programming languages have magic names to some...
2
2583
by: jyck91 | last post by:
i have done the magic square: #include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 13 main() { FILE *fp; int i, j, n, row, column;
1
4181
by: manju01 | last post by:
in the below program we can generate magic square of size 3-160 but i want to print the output like for magic size n ************************ * * * * * * 5 * 8 * 7 * 6 * ************************ that is in grid
6
6509
by: tinman77 | last post by:
Hello, I'm having a terrible time using the functions finfo_open and finfo_file. I'm using PHP 5 on IIS 5.1 and Windows XP. I have enabled php_mime_magic.dll and php_fileinfo.dll and also added the lines mime_magic.debug = Off and mime_magic.magicfile = "C:\Program Files\PHP\extras\magic.mime". Now my phpinfo() says fileinfo support is enabled and mime_magic support is enabled. However, I keep getting this error:
9
16162
by: Larry Hale | last post by:
I've heard tell of a Python binding for libmagic (file(1) *nixy command; see http://darwinsys.com/file/). Generally, has anybody built this and worked with it under Windows? The only thing I've been able to find is the python-magic module at http://hupp.org/adam/hg/python-magic/. Is this "THE" python-magic module. (It seems to be to me, but obviously I don't know. :)
0
10589
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...
0
10340
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...
1
10327
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
10085
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
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5527
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
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
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.