how to create link??
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 3
- Joined: Mon Feb 20, 2006 6:37 pm
how to create link??
hello everyone
that's my problem... i know this could be really easy for some of you.. i don't know how to create link using XSL
that's the code in XML
and this is the output in HTML in wanna have after XSL transformation
can someone help me? thank u so much!
that's my problem... i know this could be really easy for some of you.. i don't know how to create link using XSL
that's the code in XML
Code: Select all
<back>
<link type="left">pre.xml</link>
<link type="center">home.html</link>
<link type="right">ne.xml</link>
</back>
and this is the output in HTML in wanna have after XSL transformation
Code: Select all
<a href="pre.xml"><img src="aa.jpg"></a>
<a href="home.html"><img src="ab.jpg"></a>
<a href="ne.xml"><img src="ac.jpg"></a>
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Hi,
Here are two ways in which you can do this:
1) Use "xsl:element"
2)Use XPath expressions directly in attribute values.
As you can see the transformer will evaluate what is inside curly brackets in attribute values as XPath expressions.
Here is a good XSLT tutorial: http://www.zvon.org/xxl/XSLTutorial/Boo ... tents.html
Hope this helps,
Regards, Radu.
Here are two ways in which you can do this:
1) Use "xsl:element"
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="back">
<xsl:for-each select="link">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="text()"/>
</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="@type"/>
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="back">
<xsl:for-each select="link">
<a href="{text()}">
<img src="{@type}"/>
</a>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Here is a good XSLT tutorial: http://www.zvon.org/xxl/XSLTutorial/Boo ... tents.html
Hope this helps,
Regards, Radu.
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