Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XSLT 2.0 / HTML: Issue with adding "href" attribute in <a> element

857840Apr 26 2011 — edited Apr 26 2011
Hi All,

I'm trying to convert one old XSQL project from XSLT 1.0 to XSLT 2.0 and facing with the strange issue:

If source XSQL file is:

<?xml version="1.0" encoding='UTF-8'?>
<?xml-stylesheet type="text/xsl" href="test1.xsl" ?>
<page xmlns:xsql="urn:oracle-xsql">
<record>
<title>Test</title>
<link>http://my.link/test.html</link>
</record>
</page>

and transformation (test1.xsl file) is like:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8"/>
<!-- Root template -->
<xsl:template match="/">
<html>
<header>
<title>Test 1</title>
</header>
<body>
<xsl:for-each select="/page/record">
&lt;a href="{link}"><xsl:value-of select="title"/></a>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

it does NOT produce any output (serialization).

The output can be archieved ONLY if at least one of following changes is done to the stylesheet:
1. XSLT 1.0 is used:
i.e.: <xsl:stylesheet version="2.0" ... --> <xsl:stylesheet version="1.0" ...

2. Output method is NOT html / xhtml
i.e.: <xsl:output method="html" --> ...<xsl:output method="xml" ...

3. Element <a> is replaces with element of any other name
i.e.: &lt;a href="{link}"><xsl:value-of select="title"/></a> --> &lt;a1 href="{link}"><xsl:value-of select="title"/></a1>

4. Attribute "href" of element <a> is removed or renamed
i.e.: &lt;a href="{link}"><xsl:value-of select="title"/></a> --> &lt;a href1="{link}"><xsl:value-of select="title"/></a>, or &lt;a><xsl:value-of select="title"/></a>

This example was build using Oracle JDeveloper 11.1.1.0.0 and oracle.xdk_11.1.1

Does someone faced with the similar issue and what was the solution? Please share...

BR,
Sergey
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 24 2011
Added on Apr 26 2011
0 comments
419 views