Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > XML

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 11-03-2009, 02:40 PM
Iskar Iskar is offline
Registered User
 
Join Date: Nov 2009
Posts: 1
[XSLT] Problem with subelement and normal text

Hello,

I have such an XML file:
Code:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="article.xsl"?>
<article>
	<title>title</title>
            <para>Some text <link ref="some_link/">something</link> some text2</para>
</article>
and I want to turn it into an HTML file using XSLT, but I have problem with <para> element: how to extract firstly Some text, then link something and then some text2? I mean I want that:
Code:
Some text something some text2
but I get:
Code:
Some text some text2 something
with my code:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
	<html>
		<head>
			<title><xsl:value-of select="article/title"/></title>
		</head>
		<body>
			<xsl:for-each select="article/para">
				<p>
					<xsl:value-of select="."/>
					<a href="link/@ref"><xsl:value-of select="link"/></a>
				</p>
			</xsl:for-each>
		</body>
	</html>
</xsl:template>
</xsl:transform>
I have no idea how to do that and google didn't help me either. And what if I have many <link> elements in <para> element? Or other elements not only <link>?
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 09:42 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.