473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Using value-of within double quotes??

Hi,

I have a an XML file:

<xml...
<store>
<book>
<title>Darkness at Noon</title>
<price>12.99</price>
<url>http://www.amazon.com/...</url>
</book>
Mar 1 '07 #1
4 3923
Figured it out (eventually)

<xsl:for-each select="store/book">
<p><strong><value-of select="title" /></strong></p>
<p>&pound;<value-of select="price" /></p>
<p><a href="{url}">Buy book</a></p>
</xsl:for-each>
or use xsl:attribute but havent yet tried that one.

Mar 1 '07 #2
bi******@yahoo.co.uk wrote:
<p><a href="{url}">Buy book</a></p>
Yep; that's known as an Attribute Value Template (AVT), and is the
simplest way to generate an attribute with a known name.
or use xsl:attribute but havent yet tried that one.
More often used when you need to programmatically generate the
attribute's name, or when you need fancier logic in setting its value
than an AVT can support:

<p><a><xsl:attribute name="href" select="url"/>Buy book</a></p>
or

<p><a><xsl:attribute name="href"><xsl:value-of
select="url"/></xsl:attribute>Buy book</a></p>

or, for stylesheet readability reasons:
<p><a>
<xsl:attribute name="href"/>
<xsl:value-of select="url"/>
</xsl:attribute>
<xsl:text>Buy book</xsl:text>
</a></p>

.... or any of the equivalents thereof. (XSLT being a programming
language, there is usually more than one way to achieve a given result.)

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Mar 1 '07 #3
Joe Kesselman wrote:
More often used when you need to programmatically generate the
attribute's name, or when you need fancier logic in setting its value
than an AVT can support:

<p><a><xsl:attribute name="href" select="url"/>Buy book</a></p>
But xsl:attribute in XSLT 1.0 does not have a select attribute
<http://www.w3.org/TR/xslt#creating-attributes>
it is a bit dangerous to show that example above without mentioning it
is only supported in XSLT 2.0
<http://www.w3.org/TR/xslt20/#creating-attributes>


--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 1 '07 #4
Martin Honnen wrote:
But xsl:attribute in XSLT 1.0 does not have a select attribute
Whups. You're right, very sloppy of me. I did illustrate the
value-as-content solution as well; that does work in 1.0.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Mar 1 '07 #5

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

Similar topics

6
by: roger beniot | last post by:
I have a program that launches multiple threads with a ThreadStart method like the following (using System.Net.Sockets.Socket for UDP packet transfers to a server): ThreadStart pseudo code: ...
0
by: zhaoJian | last post by:
Here it is my code ,but it can't update the database.How to do it ? In _UpdateUnit event, I can not get the original value to @Original_UnitID,so I set a hidden column named LabelKey.But It...
5
by: cover | last post by:
I have an input form that passes data when submitted to a second form to let the user know what they have just entered into the db. My question comes with using 'update'. I'd like to query the...
1
by: ansc1 | last post by:
Hello, I'm new to using php coding. I need help with the following: 1. There is a submit button on the form and is saves information to my database. After clicking on "Save Measurement" it...
2
by: =?Utf-8?B?VmljdG9yIExhaQ==?= | last post by:
Hi, I wrote an simple application using VS2005 C#. I am trying to call some functions in my other dll file. This dll is written in EVC for running on Windows CE 5.0. This dll file has the...
1
by: bsprogs | last post by:
I am currnetly programming a file hosting website in PHP and I am slowly integrating AJAX into the website. Here is my problem: The user uploads the file. The server processes the file and...
3
by: akristensen | last post by:
I am new to this site, so be patient if I do not ask the question correctly. Current Target Platform: Browser: MS IE, script language: Javascript (will use VBScript, but JS is preferred), External...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
2
by: ajaxcoder | last post by:
Hi In my project i had a login form and i am trying to send the username and password to the server for authentication using xmlHttpRequest. Hence i am using POST request but i am unable to send...
7
by: Andrew | last post by:
Hi, I am using DataContractJsonSerializer to deserialize JSON string in C# objects but I am having a problem. Suppose I have a class: class Item { public ItemId Id { get; set; }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.