473,513 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I include the attribute?

Hello now I'm writing the XSL to transform the XML to an html file, and some
xml elements are:

<user login="loginname">
<name>James Cook</name>
</user>

I need to include the login attribute value in my target HTML file, and
concatenate the value with @my.addr.com. So my target HTML code will be

<a href="mailto:lo*******@my.addr.com">
James Cook
</a>

Anyone can give me some suggestions on it, thank you.
Jul 20 '05 #1
3 1531
Tempore 18:24:34, die Monday 28 February 2005 AD, hinc in foro {comp.text.xml} scripsit Zhou Lei <da*********@hotmail.com>:
<user login="loginname">
<name>James Cook</name>
</user>

I need to include the login attribute value in my target HTML file, and
concatenate the value with @my.addr.com. So my target HTML code will be

<a href="mailto:lo*******@my.addr.com">
James Cook
</a>


You can use:
a) an attribute value template:
<xsl:template match="user">
<a href="mailto:{@lo****@my.addr.com">
<xsl:apply-templates/>
</a>
</xsl:template>

or b)explicit attribute node creation:
<xsl:template match="user">
<a>
<xsl:attribute name="href">
<xsl:text>mailto:</xsl:text>
<xsl:apply-templates select="@login"/>
<xsl:text>@my.addr.com</xsl:text>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:template>

regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Fiat W3C in tenebris
Jul 20 '05 #2


Zhou Lei wrote:
Hello now I'm writing the XSL to transform the XML to an html file, and some
xml elements are:

<user login="loginname">
<name>James Cook</name>
</user>

I need to include the login attribute value in my target HTML file, and
concatenate the value with @my.addr.com. So my target HTML code will be

<a href="mailto:lo*******@my.addr.com">
James Cook
</a>


<xsl:template match="user">
<a href="mailto:{concat(@login, '@example.com')}">
<xsl:value-of select="name" />
</a>
</xsl:template>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #3

"Joris Gillis" <ro**@pandora.be> дÈëÓʼþ
news:op**************@news.pandora.be...
Tempore 18:24:34, die Monday 28 February 2005 AD, hinc in foro {comp.text.xml} scripsit Zhou Lei <da*********@hotmail.com>:
<user login="loginname">
<name>James Cook</name>
</user>

I need to include the login attribute value in my target HTML file, and
concatenate the value with @my.addr.com. So my target HTML code will be

<a href="mailto:lo*******@my.addr.com">
James Cook
</a>


You can use:
a) an attribute value template:
<xsl:template match="user">
<a href="mailto:{@lo****@my.addr.com">
<xsl:apply-templates/>
</a>
</xsl:template>

or b)explicit attribute node creation:
<xsl:template match="user">
<a>
<xsl:attribute name="href">
<xsl:text>mailto:</xsl:text>
<xsl:apply-templates select="@login"/>
<xsl:text>@my.addr.com</xsl:text>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:template>

regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Fiat W3C in tenebris


Thank you and Martin very much it works! :-)
Jul 20 '05 #4

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

Similar topics

21
3280
by: Peter Bassett | last post by:
I have a .shtml file, that displays photos, in which I wish to pass some functionality off to an Include file for reusability purposes. Unfortunately, it's not working. Here is a portion of the...
5
18850
by: Mario T. Lanza | last post by:
If you're a web designer, you have undoubtedly used cascading style sheets in order to improve your sites separation of form and content. You probably also use Server-side include files to include...
1
1627
by: RWC | last post by:
Hey Folks! I'm having trouble with an asp page. First off, I'm new to the html / asp world, but not to software development. I'd like to minimize or "normalize" the site, so I'm trying to use...
3
4017
by: John Yopp | last post by:
I seem to be have problems with what appears to be variable scoping. If I define a constant in my main HTML page, I do not seem to be able to reference it within functions in JavaScript include...
3
1350
by: Rick | last post by:
Is it possible to include a file from another server in html? I have typed <!-- #include file="http://Nlg-info/PESE/PESE.asp" --> is this the correct code? I cannot have the files together as...
5
4044
by: Viken Karaguesian | last post by:
Hello all, I've used the SSI Include command successfully in the past to include frequently used files that are based within my own site. However, what if I was to use a file located in a...
2
1852
by: Rolf Welskes | last post by:
Hello, I have simple in one folder FolderA MyMaster.master and script01.js styles01.css The content pages are in
9
1844
by: skijor | last post by:
I am converting a raw html webiste to use javascript. A lot of the html code is duplicated in many pages. Some of that code can be consolidated into javacript but I don't want to add the same...
3
3586
by: Simon Brooke | last post by:
I'm trying to do internationalisation by using xsl:include to include a different file depending on the locale setting, and I'm completely failing. I've tried several different approaches: ...
0
7158
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...
0
7535
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...
1
7098
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...
1
5085
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...
0
3232
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...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1592
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 ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
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...

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.