473,383 Members | 2,005 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,383 software developers and data experts.

can't seem to figure out...

<inbox>
<email>
<to>John Doe</to>
<from>Jane Doe</from>
<subject>This is the subject</subject>
<paragraph>P1</paragraph>
<paragraph>P2</paragraph>
<paragraph>P3</paragraph>
<paragraph>P4</paragraph>
</email>
</inbox>

I'm trying to get the text within the multiple <paragraph> tags through
XSLT. If I have the following XSLT stylesheet:

<xsl:template match="/">
<html>
<body>
<p>To: <xsl:value-of select="to"/></p>
<p>From: <xsl:value-of select="from"/></p>
<p>Subject: <xsl:value-of select="subject"/></p>
</body>
</html>
</xsl:template>

If I want to cycle through the four paragraphs in the above, how would
I do that? I was thinking of using <xsl:for-each> but couldn't figure
out how to get the text.

Thanks...

Apr 10 '06 #1
1 1131
Your thought about xsl:for-each is one solution:
<xsl:for-each select="paragraph">
<xsl:value-of select="."/>
</xsl:for-each>

A more idiomatic solution would be to write a template for each of the
element types and let apply-template recursion take care of this iteration.

<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="to">
<p>To: <xsl:value-of select="."/></p>
</xsl:template>
<xsl:template match="from">
<p>From: <xsl:value-of select="."/></p>
</xsl:template>
<xsl:template match="subject">
<p>Subject: <xsl:value-of select="."/></p>
</xsl:template>
<xsl:template match="paragraph">
<p><xsl:value-of select="."/></p>
</xsl:template>


--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Apr 10 '06 #2

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

Similar topics

20
by: Andy | last post by:
Hi All! General statement: FK should not be nullabe to avoid orphans in DB. Real life: Business rule says that not every record will have a parent. It is implemented as a child record has FK...
3
by: Matthew | last post by:
Ok, this may seem like a really stupid code help request, but i've got this funny little longstanding Javascript bug going on with Netscape that I've finally nailed... but only if I can get these...
0
by: Scott Wilkins | last post by:
Hi! I'm an old VB ASP coder, and just started to get wet in ASP.NET this week. I've already run into one very simple problem I can't seem to figure out. In VB ASP code, I could write code,...
15
by: lawrence | last post by:
Sorry for the dumb question but I'm new to Javascript. I wrote this script hoping to animate some div blocks on a page. You can see the page here: http://www.keymedia.biz/demo.htm Can anyone...
2
by: Earthling | last post by:
Dear Access Programmers, I can't seem to figure this out. The text boxes that are used to input data via my form are unbound, I want to restrict the user to only put input that is one line. ...
102
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler...
2
by: g35rider | last post by:
Hi, I have the following code that is giving this error, I cant simplify the code, I was just testing some theory for something we are doing and was getting an issue here. Please someone point out...
8
by: Microsoft News | last post by:
Greetings community at large. I have a c# app that generates a PDF file. I have a printer that prints PDF natively. But I cannot figure out how to programatically print in C# ... I can...
7
by: frustrated777 | last post by:
I'm new to mysql but seem to understand it enough to do what simple stuff I need but I can't get even this basic script to echo what is in the one colum, one row table. I am able to connect now it...
7
by: moltendorf | last post by:
Okay... so I'm generating a custom Slideshow tool for my friend... and I never seem to get any replies from Webberdev, so here I am, posting on a completely new forum... Anyways, the code is here:...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.