Jump to content
  • Advertisement
Sign in to follow this  
Tutukun

[web] Help a newbie with XML tranforming

This topic is 4152 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 :)

Share this post


Link to post
Share on other sites
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! :)

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!