473,672 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Embedding xlst element into html tag

Hi!

I'm absolutely newbie with XSLT. Please, help me with this example.

I have simple XML document like this:

<skip />
<aaa>
<link url="url1" />
<link url="url2" />
<skip />
</aaa>
<skip />

that should be transformed to HTML like:

...
<a href="url1">url 1</a>
<a href="url2">url 2</a>
...

I suppose, it may looks like this:

<skip />
</xsl:template match="aaa">
<xsl:for-each select="link">
<a href="???"><xsl :value-of select="./@url" /></a>
</xsl:for-each>
</xsl:template>
<skip />

with "./@url" value in place of "???". But I can't use XPath inside
html tags. How can I embed xlst element into html tag? If it's
impossible, how to implement this transformation?

TIA,
Vital Lobachevsky
Jul 20 '05 #1
1 3059
In article <da************ **************@ posting.google. com>,
Vital Lobachevsky <ti**@tochka.by > wrote:

% </xsl:template match="aaa">
% <xsl:for-each select="link">
% <a href="???"><xsl :value-of select="./@url" /></a>
% </xsl:for-each>
% </xsl:template>
%
% with "./@url" value in place of "???". But I can't use XPath inside
% html tags. How can I embed xlst element into html tag? If it's
% impossible, how to implement this transformation?

You can, using an attribute value template:

</xsl:template match="aaa">
<xsl:for-each select="link">
<a href="{@url}">< xsl:value-of select="./@url" /></a>
</xsl:for-each>
</xsl:template>

You can also use xsl:attribute:

</xsl:template match="aaa">
<xsl:for-each select="link">
<a>
<xsl:attribut e name='href'><xs l:value-of select='@url'/></xsl:attribute>
<xsl:value-of select="./@url" /></a>
</xsl:for-each>
</xsl:template>
--

Patrick TJ McPhee
East York Canada
pt**@interlog.c om
Jul 20 '05 #2

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

Similar topics

8
1338
by: WStoreyII | last post by:
Hello, I have a cgi program made in c which will output xml that I have obtained from a mysql database. I have the xml output setup to be transformed by blog.xsl in the header of the xml output. My problem is that one of the element of the xml will be a element called article which will contain a text string that has html tags from the msyql database. what i want is that in the xsl it slaps the article element
3
2228
by: Mr. Clean | last post by:
Very new to XML style sheets and need some help getting this XML: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE CDSLogger SYSTEM "CDSLogger.dtd"> <CDSLogger> <ErrorObject> <BatchName>This is the first batch</BatchName> <ErrorCode>12904</ErrorCode> <Success>True</Success> </ErrorObject>
53
4445
by: Andrew Poulos | last post by:
I've got some CSS that looks like this: body { margin: 0; font-family: Arial, Helvetica, sans-serif; font-size: 140.01%; color: #000000; } but IE won't apply the font size to text in table cells so I've had to
8
1788
by: Alan Lue | last post by:
Hi, I'm trying to set up a webpage so that I can view multiple HTML files from the same page. For example, you might go to http://example.com/lab_tests.html and be able to view lab1.html, lab2.html, and lab3.html right on that page. If you're viewing this message w/a monospace font, the page layout might look like this: +-------------------+ | Header | * Code for Header and
3
2622
by: Hai Nguyen | last post by:
I would like to know after transforming my datatables which store in dataset into XML form. Now I want to save it into a file and also create a XLST file to read it. How can I do that? Would you give me any advice or link to further my understandings. Thanks for any clues
3
1468
by: Hai Nguyen | last post by:
Sorry I don't have code yet. I'm asking for solutions which can help me solve the problem. This is the first time I have to cope this situation, hence I'm clueless how to start. I would like to ask for some ideas then I can start from scratch. Let's say: I have a dataset which has a table Customers (which retrieves from an Access Database) 1/ I convert it into XML format, it should look like this <Customer> <Name>...</Name>
1
1407
by: stefano | last post by:
Hi, I have a file xml (p.xml) and I use XSLT to trasform p.xml to XHTML. this is the xml file: .... <test label="x"> <itemList> <testItem oknumber="2" > .... </testItem> </itemList>
0
1422
by: hq4000 | last post by:
Given AStyleSheet.xsl : <AStyleSheet> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.mytest.mytest2.mytest3.com" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <xsl:element name="Test">it works</xsl:element> </xsl:template>
2
4072
by: John Grandy | last post by:
I am not having success embedding carriage return and line feed characters into a string and displaying them with an ASP.NET label. Is anyone getting either of the following to work ? StringBuilder message = new StringBuilder(); message.Append("Line 1"); message.Append("\r\n"); message.Append("Line 2"); Label.Text = message.ToString();
0
8403
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
8828
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
8677
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
7446
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...
1
6238
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
4227
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
2819
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
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
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.