473,320 Members | 1,810 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,320 software developers and data experts.

XSL: combining multiple XML elements to autogenerate an href?

20
Hello,

I am using XML to create a library of files, which I then display as a table using XSL. This works fine, but I would like the last column to be a link to the file. Rather than store the actual link code in the XML, I want to automatically generate it using the XSL. I can do this because the href is basically a combination of the other elements.

Here is a snippet of XSL to show what I mean:

Expand|Select|Wrap|Line Numbers
  1. <td><xsl:value-of select="principle"/><xsl:value-of select="row"/>_<xsl:value-of select="proficiency"/><xsl:value-of select="example"/>.php</td>
  2.  
This works great to write out, in text form, what the href should be. However, when it comes to actually making an href, I'm at a loss. I tried this, and obviously it didn't work:

Expand|Select|Wrap|Line Numbers
  1. <td><a href="{normalize-space(illustration_<xsl:value-of select="principle"/><xsl:value-of select="row"/>_<xsl:value-of select="proficiency"/><xsl:value-of select="example"/>.php)}">Link</a></td>
Any suggestions?
Nov 28 '07 #1
1 1486
TAL651
20
Actually, I just solved the problem, by using <xsl:attribute name="href'>.

Here is the new code to autogenerate my href:

Expand|Select|Wrap|Line Numbers
  1. <td><a><xsl:attribute name="href">illustration_<xsl:value-of select="principle"/><xsl:value-of select="row"/>_<xsl:value-of select="proficiency"/><xsl:value-of select="example"/>.php</xsl:attribute>Link</a></td>
Nov 28 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Vince C. | last post by:
Hi all, I've created XML documents that are described with a schema. I'm using those documents to create web pages. All my web pages contain a fixed header and a variable document part. The...
6
by: chris | last post by:
Hi, After going back through the XSL tutorials and the help here I have largely solved the problem of merging two XHTML files, but one small detail remains... The parser outputs <html...
1
by: schilde | last post by:
Hello, I want to transform a xml to html with xsl which is not this big problem. But when I want to create a link with informations of the xml it doesn't work. To illustrate the problem here an...
2
by: Peter Gerstbach | last post by:
Hello, I need help on the new xsl:document element! I'm using XSLT version 1.1 to be able to use the <xsl:document> element, because I need more than 1 output files. I'm using Saxon 6.5.3 My...
8
by: mikea_59 | last post by:
I am having trouble combining similar elements. Elements can be combined if they have the same name and the same attribute values. I can handle single level elements but am having problems with...
8
by: Gerald Aichholzer | last post by:
Hello NG, I try to apply the following template <xsl:template match="objectgroup"> <xsl:copy> <xsl:apply-templates select="*|@*"/> <xsl:variable name="object" select="."/> <xsl:for-each...
13
by: Toby Newman | last post by:
I started learning XML on Monday. I have an XML file and have written an XSL file to render it to HTML for formatted viewing in a browser. I'd like to create a second alternative view of the...
3
by: jszczepankiewicz | last post by:
Witam, mam nastepujacy problem: XSLT 2.0, Hi, i've got following problem with xslt 2: my xml doc looks something linke: <manual>
5
by: jhurrell | last post by:
I have been having some trouble getting my XSL style sheet to parse correctly. I have some XML outputted from an SQL-Server, that I then need to turn into multiple HTML files. This I have done...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.