[web] Help a newbie with XML tranforming

Started by
1 comment, last by Tutukun 17 years ago
Hi, I'm trying some xml to html examples, and I'm kinda stuck. For example i have the following xml

 <para>
        Hi pls visit my website at <url>http://www.abc.com</url>.
 </para>
Could anyone help me form it into something that look like:
Quote: Hi pls visit my website at http://www.abc.com
using XSLT? Sorry for my bad english. Thank you :)
Advertisement
For the fragment of XML you posted, the fragment of XSL would look something like this:
	<xsl:template match="para">		<p>			<xsl:apply-templates match="*" />		</p>	</xsl:template>	<xsl:template match="url">		<i>			<xsl:apply-templates match="*" />		</i>	</xsl:template>	<xsl:template match="text()">		<xsl:value-of select="." />	</xsl:template>


Edit: err, the forum messes with the HTML tags! :)
Quote:Original post by Paulius Maruska
For the fragment of XML you posted, the fragment of XSL would look something like this:
	<xsl:template match="para">		<p>			<xsl:apply-templates match="*" />		</p>	</xsl:template>	<xsl:template match="url">		<i>			<xsl:apply-templates match="*" />		</i>	</xsl:template>	<xsl:template match="text()">		<xsl:value-of select="." />	</xsl:template>


Edit: err, the forum messes with the HTML tags! :)


Thank for helping me out.

Now, it gives me the "Attribute match is not allowed on this element" error @ all the apply-templates match any idea why?

This topic is closed to new replies.

Advertisement