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>?