Help a newbie with XML tranforming
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 2
- Joined: Sun May 13, 2007 9:17 am
Help a newbie with XML tranforming
Hi,
I'm trying some xml to html examples, and I'm kinda stuck. For example i have the following xml
Could anyone help me form it into something that look like:
Sorry for my bad english.
Thank you
I'm trying some xml to html examples, and I'm kinda stuck. For example i have the following xml
Code: Select all
<para>
Hi pls visit my website at <url>http://www.abc.com</url>.
</para>
using XSLT?Hi pls visit my website at http://www.abc.com
Sorry for my bad english.
Thank you

-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
You can start with a recursive copy template and then add in two rules (templates) to hanle your two cases:
Regards,
George
Code: Select all
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="para">
<p><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="url">
<a href="{.}"><xsl:value-of select="."/></a>
</xsl:template>
</xsl:stylesheet>
George
George Cristian Bina
-
- Posts: 2
- Joined: Sun May 13, 2007 9:17 am
This is exactly what I need. Thank you very muchgeorge wrote:You can start with a recursive copy template and then add in two rules (templates) to hanle your two cases:
Regards,Code: Select all
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="para">
<p><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="url">
<a href="{.}"><xsl:value-of select="."/></a>
</xsl:template>
</xsl:stylesheet>
George

Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service