8022548: SPECJVM2008 has errors introduced in 7u40-b34
Reviewed-by: chegar, lancea
This commit is contained in:
parent
9db3bb4e9c
commit
1848c820d0
14
jdk/test/javax/xml/jaxp/parsers/8022548/JDK8022548.xml
Normal file
14
jdk/test/javax/xml/jaxp/parsers/8022548/JDK8022548.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<?xml-stylesheet type="text/xsl" href="../resources/style/pagex.xsl"?>
|
||||
|
||||
<my:doc xmlns:my="http://www.jenitennison.com/" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<p>
|
||||
These pages are all about XSLT, an XML-based language for translating one set of XML into another set of XML, or into HTML. Of course, there are all sorts of <my:link href="#links">other pages</my:link> around that cover XSLT. Jeni's XSLT Pages, though, are dedicated to helping people understand and make the most of using XSLT.
|
||||
</p>
|
||||
<p>
|
||||
My warmest thanks to all those people who post interesting problems on <my:link href="http://www.mulberytech.com/xsl/xsl-list/">XSL-List</my:link>, and especially to those of you that have encouraged me to set up this site through your kind emails.
|
||||
</p>
|
||||
|
||||
</my:doc>
|
618
jdk/test/javax/xml/jaxp/parsers/8022548/JDK8022548.xsl
Normal file
618
jdk/test/javax/xml/jaxp/parsers/8022548/JDK8022548.xsl
Normal file
@ -0,0 +1,618 @@
|
||||
<?xml version="1.0" encoding='UTF-8'?>
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0"
|
||||
xmlns:my="http://www.jenitennison.com/"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcq="http://purl.org/dc/qualifiers/1.0/"
|
||||
xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt"
|
||||
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
|
||||
exclude-result-prefixes="rdf dc dcq my html vcf msxsl">
|
||||
|
||||
<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
cdata-section-elements="script"
|
||||
indent="no"
|
||||
method="xml"
|
||||
encoding='UTF-8'/>
|
||||
|
||||
<xsl:param name="dynamic" select="'true'" />
|
||||
<xsl:param name="base" select="'/'" />
|
||||
|
||||
<xsl:variable name="supports-document" select="function-available('document')" />
|
||||
<xsl:variable name="supports-keys" select="function-available('key')" />
|
||||
|
||||
<xsl:variable name="default-title" select='"Jeni's XML Site"' />
|
||||
|
||||
<xsl:template match="my:doc">
|
||||
<xsl:variable name="metadata" select="/*/rdf:RDF" />
|
||||
<xsl:variable name="uri" select="$metadata/rdf:Description[1]/@about" />
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
<xsl:call-template name="get-metadata">
|
||||
<xsl:with-param name="what" select="'title'" />
|
||||
<xsl:with-param name="about" select="$uri" />
|
||||
</xsl:call-template>
|
||||
</title>
|
||||
<xsl:call-template name="get-metadata">
|
||||
<xsl:with-param name="what" select="'link'" />
|
||||
<xsl:with-param name="about" select="$uri" />
|
||||
</xsl:call-template>
|
||||
<link rel="alternate" type="text/xml" href="{$uri}" />
|
||||
<xsl:call-template name="get-metadata">
|
||||
<xsl:with-param name="what" select="'rights'" />
|
||||
<xsl:with-param name="about" select="$uri" />
|
||||
</xsl:call-template>
|
||||
</head>
|
||||
<body>
|
||||
<xsl:if test="$dynamic = 'false'">
|
||||
<p id="xml-link">
|
||||
Try the <a href="{$uri}">XML version</a> of this page.
|
||||
If you have problems with it, consult the
|
||||
<a href="/compatibility.html">compatibility page</a>.
|
||||
</p>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates select="." mode="colophon" />
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="html:h1">
|
||||
<h1>
|
||||
<xsl:apply-templates />
|
||||
<xsl:call-template name="insert-navigation" />
|
||||
</h1>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="insert-navigation">
|
||||
<xsl:variable name="metadata" select="/*/rdf:RDF" />
|
||||
<xsl:variable name="uri" select="$metadata/rdf:Description[1]/@about" />
|
||||
<xsl:if test="$uri != concat($base, 'index.xml')">
|
||||
<span id="link-top">
|
||||
<a class="img">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$dynamic = 'true'">/index.xml</xsl:when>
|
||||
|
||||
<xsl:otherwise>/index.html</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<img src="{$base}resources/icons/top.gif" width="29" height="29" />
|
||||
</a>
|
||||
</span>
|
||||
<span id="link-up">
|
||||
<a class="img">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($uri, 'index.xml')">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$dynamic = 'true'">../index.xml</xsl:when>
|
||||
<xsl:otherwise>../index.html</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$dynamic = 'true'">index.xml</xsl:when>
|
||||
<xsl:otherwise>index.html</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<img src="{$base}resources/icons/up.gif" width="29" height="29" />
|
||||
</a>
|
||||
</span>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="rdf:RDF" />
|
||||
|
||||
<xsl:template name="get-metadata">
|
||||
<xsl:param name="what" />
|
||||
<xsl:param name="about" select="/*/rdf:RDF/rdf:Description/@about" />
|
||||
<xsl:variable name="metadata" select="/*/rdf:RDF" />
|
||||
<xsl:variable name="type">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($what, '::')">
|
||||
<xsl:value-of select="substring-before($what, '::')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$what" /></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="mode">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($what, '::')">
|
||||
<xsl:value-of select="substring-after($what, '::')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise />
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:apply-templates select="$metadata/rdf:Description[@about = $about or
|
||||
(@aboutEachPrefix != '' and starts-with($about, @aboutEachPrefix))]/*[local-name() = $type]">
|
||||
<xsl:with-param name="mode" select="$mode" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="rdf:Description/*">
|
||||
<xsl:param name="mode" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="@rdf:resource != ''">
|
||||
<xsl:call-template name="get-metadata">
|
||||
<xsl:with-param name="about" select="@rdf:resource" />
|
||||
<xsl:with-param name="what" select="$mode" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$mode = '' and @rdf:value != ''">
|
||||
<xsl:value-of select="@rdf:value" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$mode = '' and *">
|
||||
<xsl:apply-templates />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates select="." mode="get-metadata">
|
||||
<xsl:with-param name="mode" select="$mode" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="html:link" mode="get-metadata">
|
||||
<link>
|
||||
<xsl:copy-of select="@*" />
|
||||
</link>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="dc:rights" mode="get-metadata">
|
||||
<xsl:comment>
|
||||
<xsl:value-of select="." />
|
||||
</xsl:comment>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="dc:date" mode="get-metadata">
|
||||
<xsl:param name="mode" select="''" />
|
||||
<xsl:if test="$mode = @dcq:dateType">
|
||||
<xsl:value-of select="@rdf:value" />
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="vcf:vCard" mode="get-metadata">
|
||||
<xsl:param name="mode" select="''" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$mode = 'mailto-link'">
|
||||
<xsl:call-template name="link">
|
||||
<xsl:with-param name="link">
|
||||
<xsl:choose>
|
||||
<xsl:when test="vcf:email[contains(@email.type, 'PREF')]">
|
||||
<xsl:value-of select="vcf:email[contains(@email.type, 'PREF')]" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="vcf:email[1]" /></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="value">
|
||||
<xsl:apply-templates select="vcf:n" mode="full" />
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$mode = 'name'">
|
||||
<xsl:apply-templates select="vcf:n" mode="full" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise />
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="vcf:n" mode="full">
|
||||
<xsl:if test="vcf:prefix">
|
||||
<xsl:value-of select="vcf:prefix" /><xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="../vcf:nickname">
|
||||
<xsl:value-of select="../vcf:nickname" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="vcf:given" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="vcf:family" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="html:*">
|
||||
<xsl:element name="{local-name()}">
|
||||
<xsl:copy-of select="@*" />
|
||||
<xsl:apply-templates />
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:vars">
|
||||
<dl>
|
||||
<xsl:apply-templates />
|
||||
</dl>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:var">
|
||||
<dt id="{translate(my:name, ' ', '-')}">
|
||||
<xsl:text/>$<xsl:value-of select="my:name" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="my:value">
|
||||
<xsl:text/> = <xsl:apply-templates select="my:value" />
|
||||
</xsl:when>
|
||||
<xsl:when test="my:default">
|
||||
<xsl:text/> [= <xsl:apply-templates select="my:default" />]<xsl:text/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</dt>
|
||||
<dd>
|
||||
<xsl:if test="my:desc"><xsl:apply-templates select="my:desc" /></xsl:if>
|
||||
<xsl:if test="my:option">
|
||||
<ul>
|
||||
<xsl:apply-templates select="my:option" />
|
||||
</ul>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="my:defn" />
|
||||
</dd>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:option">
|
||||
<li><xsl:apply-templates select="my:value" />: <xsl:apply-templates select="my:desc" /></li>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:value | my:default">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type">
|
||||
<span class="{@type}">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type = 'string'">'<xsl:value-of select="." />'</xsl:when>
|
||||
<xsl:when test="@type = 'rtf'">"<xsl:value-of select="." />"</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="." /></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</span>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="." />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:post">
|
||||
<div class="post">
|
||||
<xsl:apply-templates />
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:response">
|
||||
<div class="response">
|
||||
<xsl:apply-templates />
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:question">
|
||||
<div class="question">
|
||||
<p>
|
||||
<xsl:call-template name="insert-icon">
|
||||
<xsl:with-param name="icon" select="'question'" />
|
||||
<xsl:with-param name="active" select="false()" />
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="*[1]/node()" />
|
||||
</p>
|
||||
<xsl:apply-templates select="*[position() > 1]"/>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:example | my:defn">
|
||||
<pre>
|
||||
<xsl:apply-templates />
|
||||
</pre>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:example[parent::my:aside and ancestor::my:example]">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$dynamic = 'true'">
|
||||
<pre>
|
||||
<xsl:apply-templates />
|
||||
</pre>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<span class="example">
|
||||
<xsl:apply-templates />
|
||||
</span>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:example[parent::my:aside and not(ancestor::my:example)]">
|
||||
<xsl:call-template name="split-and-code">
|
||||
<xsl:with-param name="text" select="string(.)" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="split-and-code">
|
||||
<xsl:param name="text" />
|
||||
<br />
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($text, '
')">
|
||||
<code><xsl:value-of select="substring-before($text, '
')" /></code>
|
||||
<xsl:call-template name="split-and-code">
|
||||
<xsl:with-param name="text" select="substring-after($text, '
')" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<code><xsl:value-of select="$text" /></code>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:aside">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$dynamic = 'true'">
|
||||
<span class="note"
|
||||
><img src="{$base}resources/icons/note.gif" height="17" width="13" border="0"
|
||||
style="z-index: 2;"
|
||||
onmouseover="javascript:{generate-id()}.style.visibility='visible';"
|
||||
onmouseout="javascript:{generate-id()}.style.visibility='hidden';"
|
||||
/><span class="popup" id="{generate-id()}"
|
||||
onmouseover="javascript:{generate-id()}.style.visibility='visible';"
|
||||
onmouseout="javascript:{generate-id()}.style.visibility='hidden';">
|
||||
<xsl:apply-templates />
|
||||
</span
|
||||
></span>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text> </xsl:text>
|
||||
<span class="note">[<xsl:apply-templates />]</span>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:quote">
|
||||
<blockquote uri="{@href}">
|
||||
<xsl:apply-templates />
|
||||
</blockquote>
|
||||
<p class="byline">
|
||||
<xsl:text>[From </xsl:text>
|
||||
<xsl:call-template name="link">
|
||||
<xsl:with-param name="link" select="@href" />
|
||||
<xsl:with-param name="value">
|
||||
<xsl:value-of select="@href" />
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:text>]</xsl:text>
|
||||
</p>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:icon">
|
||||
<xsl:call-template name="insert-icon">
|
||||
<xsl:with-param name="icon" select="@name" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="insert-icon">
|
||||
<xsl:param name="icon" select="'goto'" />
|
||||
<xsl:param name="active" select="true()" />
|
||||
<img src="{$base}resources/icons/{$icon}.gif" height="28" width="28" border="0">
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="$base" />
|
||||
<xsl:text>resources/icons/</xsl:text>
|
||||
<xsl:if test="not($active)">click-</xsl:if>
|
||||
<xsl:value-of select="$icon" />
|
||||
<xsl:text>.gif</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="$active">
|
||||
<xsl:attribute name="onmouseover">javascript:this.src='<xsl:value-of select="$base" />resources/icons/over-<xsl:value-of select="$icon" />.gif'</xsl:attribute>
|
||||
<xsl:attribute name="onclick">javascript:this.src='<xsl:value-of select="$base" />resources/icons/click-<xsl:value-of select="$icon" />.gif'</xsl:attribute>
|
||||
<xsl:attribute name="onmouseout">javascript:this.src='<xsl:value-of select="$base" />resources/icons/<xsl:value-of select="$icon" />.gif'</xsl:attribute>
|
||||
</xsl:if>
|
||||
</img>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:links">
|
||||
<xsl:choose>
|
||||
<xsl:when test="parent::html:dd">
|
||||
<xsl:apply-templates select="my:link" mode="list" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="columnise">
|
||||
<xsl:with-param name="max-height" select="3" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="columnise">
|
||||
<xsl:param name="max-height" select="5" />
|
||||
<xsl:param name="max-width" select="3" />
|
||||
<xsl:variable name="no-items" select="count(*)" />
|
||||
<xsl:variable name="width">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$no-items > $max-height * $max-width">
|
||||
<xsl:value-of select="$max-width" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="ceiling($no-items div $max-height)" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="height" select="ceiling($no-items div $width)" />
|
||||
<table>
|
||||
<colgroup span="{$width}" />
|
||||
<tr>
|
||||
<xsl:for-each select="*[position() = 1 or position() mod $height = 1]">
|
||||
<td>
|
||||
<xsl:apply-templates select=". | following-sibling::*[position() < $height]" mode="list" />
|
||||
</td>
|
||||
</xsl:for-each>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:link" mode="list">
|
||||
<p class="link">
|
||||
<xsl:call-template name="link">
|
||||
<xsl:with-param name="link" select="@href" />
|
||||
<xsl:with-param name="value">
|
||||
<xsl:value-of select="." />
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="addicon" select="true()" />
|
||||
</xsl:call-template>
|
||||
</p>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="my:link">
|
||||
<xsl:apply-templates select="." mode="link" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*[@href][. != '']" mode="link">
|
||||
<xsl:call-template name="link">
|
||||
<xsl:with-param name="link" select="@href" />
|
||||
<xsl:with-param name="value">
|
||||
<xsl:apply-templates />
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="addicon" select="@addicon" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*[@href][. = '']" mode="link">
|
||||
<xsl:call-template name="link">
|
||||
<xsl:with-param name="link" select="@href" />
|
||||
<xsl:with-param name="value">
|
||||
<xsl:value-of select="@href" />
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="addicon" select="@addicon" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text()|@*" mode="link">
|
||||
<xsl:call-template name="link">
|
||||
<xsl:with-param name="link" select="." />
|
||||
<xsl:with-param name="value">
|
||||
<xsl:value-of select="." />
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="link">
|
||||
<xsl:param name="link" />
|
||||
<xsl:param name="value" />
|
||||
<xsl:param name="addicon" select="''" />
|
||||
<xsl:variable name="uri">
|
||||
<xsl:call-template name="full-uri">
|
||||
<xsl:with-param name="uri" select="$link" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="class">
|
||||
<xsl:call-template name="uri-class">
|
||||
<xsl:with-param name="uri" select="$uri" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:if test="$addicon">
|
||||
<a href="{$uri}">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>img </xsl:text>
|
||||
<xsl:value-of select="$class" />
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="insert-icon">
|
||||
<xsl:with-param name="icon">
|
||||
<xsl:call-template name="icon-type">
|
||||
<xsl:with-param name="uri" select="$uri" />
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</a>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
<a href="{$uri}">
|
||||
<xsl:if test="$class != ''">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:value-of select="$class" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:copy-of select="$value" />
|
||||
</a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="full-uri">
|
||||
<xsl:param name="uri" />
|
||||
<xsl:variable name="partial-uri">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$dynamic='false' and
|
||||
substring($uri, string-length($uri) - 3, 4) = '.xml'">
|
||||
<xsl:value-of select="concat(substring($uri, 1, string-length($uri) - 4), '.html')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$uri" /></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with($partial-uri, 'www')">
|
||||
<xsl:text>http://</xsl:text><xsl:value-of select="$partial-uri" />
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($partial-uri, '@') and not(starts-with($partial-uri, 'mailto:'))">
|
||||
<xsl:text>mailto:</xsl:text><xsl:value-of select="$partial-uri" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$partial-uri" /></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="uri-class">
|
||||
<xsl:param name="uri" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with($uri, 'http://') and not(starts-with($uri, $base))">offsite</xsl:when>
|
||||
<xsl:when test="starts-with($uri, 'mailto:')">mailto</xsl:when>
|
||||
<xsl:when test="starts-with($uri, '#')">local</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="icon-type">
|
||||
<xsl:param name="uri" />
|
||||
<xsl:variable name="url">
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with($uri, 'http://')"><xsl:value-of select="substring-after($uri, 'http://')" /></xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$uri" /></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="(not(contains($url, '/')) and starts-with($url, 'www.')) or (contains($url, '/') and not(substring-after($url, '/')))">home</xsl:when>
|
||||
<xsl:when test="contains($url, '@')">mail</xsl:when>
|
||||
<xsl:otherwise>goto</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/*" mode="colophon">
|
||||
<xsl:variable name="metadata" select="/*/rdf:RDF" />
|
||||
<xsl:variable name="uri" select="$metadata/rdf:Description[1]/@about" />
|
||||
<div id="colophon">
|
||||
<hr class="final" />
|
||||
<p>
|
||||
<xsl:apply-templates select="$uri" mode="link" />
|
||||
<xsl:variable name="modified">
|
||||
<xsl:call-template name="get-metadata">
|
||||
<xsl:with-param name="what" select="'date::modified'" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:if test="string($modified)">
|
||||
<xsl:text> last modified </xsl:text>
|
||||
<xsl:copy-of select="$modified" />
|
||||
</xsl:if>
|
||||
<xsl:variable name="creator">
|
||||
<xsl:call-template name="get-metadata">
|
||||
<xsl:with-param name="what" select="'creator::vCard::mailto-link'" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:text> by </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="string($creator)">
|
||||
<xsl:copy-of select="$creator" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<a href="mailto:mail@jenitennison.com" class="mailto">Jeni Tennison</a>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</p>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
73
jdk/test/javax/xml/jaxp/parsers/8022548/TestBase.java
Normal file
73
jdk/test/javax/xml/jaxp/parsers/8022548/TestBase.java
Normal file
@ -0,0 +1,73 @@
|
||||
|
||||
import java.security.Policy;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author huizhe.wang@oracle.com
|
||||
*/
|
||||
public class TestBase {
|
||||
public String filePath;
|
||||
boolean hasSM;
|
||||
String curdir;
|
||||
Policy origPolicy;
|
||||
|
||||
String testName;
|
||||
String errMsg;
|
||||
|
||||
int passed = 0, failed = 0;
|
||||
|
||||
/**
|
||||
* Creates a new instance of StreamReader
|
||||
*/
|
||||
public TestBase(String name) {
|
||||
testName = name;
|
||||
}
|
||||
|
||||
//junit @Override
|
||||
protected void setUp() {
|
||||
if (System.getSecurityManager() != null) {
|
||||
hasSM = true;
|
||||
System.setSecurityManager(null);
|
||||
}
|
||||
|
||||
filePath = System.getProperty("test.src");
|
||||
if (filePath == null) {
|
||||
//current directory
|
||||
filePath = System.getProperty("user.dir");
|
||||
}
|
||||
origPolicy = Policy.getPolicy();
|
||||
|
||||
}
|
||||
|
||||
//junit @Override
|
||||
public void tearDown() {
|
||||
// turn off security manager and restore policy
|
||||
System.setSecurityManager(null);
|
||||
Policy.setPolicy(origPolicy);
|
||||
if (hasSM) {
|
||||
System.setSecurityManager(new SecurityManager());
|
||||
}
|
||||
System.out.println("\nNumber of tests passed: " + passed);
|
||||
System.out.println("Number of tests failed: " + failed + "\n");
|
||||
|
||||
if (errMsg != null ) {
|
||||
throw new RuntimeException(errMsg);
|
||||
}
|
||||
}
|
||||
|
||||
void fail(String msg) {
|
||||
if (errMsg == null) {
|
||||
errMsg = msg;
|
||||
} else {
|
||||
errMsg = errMsg + "\n" + msg;
|
||||
}
|
||||
failed++;
|
||||
}
|
||||
|
||||
void success(String msg) {
|
||||
passed++;
|
||||
System.out.println(msg);
|
||||
}
|
||||
|
||||
}
|
127
jdk/test/javax/xml/jaxp/parsers/8022548/XOMParserTest.java
Normal file
127
jdk/test/javax/xml/jaxp/parsers/8022548/XOMParserTest.java
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test @bug 8022548
|
||||
* @summary test that a parser can use DTDConfiguration
|
||||
* @run main XOMParserTest
|
||||
*/
|
||||
import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.parsers.*;
|
||||
import java.io.*;
|
||||
import javax.xml.transform.*;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
* <p>Test {@link javax.xml.transform.Transformer} for JDK-8022548: SPECJVM2008
|
||||
* has errors introduced in 7u40-b34
|
||||
*
|
||||
* Test XOM is supported after jaxp 1.5 </p>
|
||||
*
|
||||
* @author Joe Wang <huizhe.wang@oracle.com>
|
||||
*
|
||||
*/
|
||||
public class XOMParserTest extends TestBase {
|
||||
|
||||
public XOMParserTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
XOMParserTest test = new XOMParserTest("XOM parser test");
|
||||
test.setUp();
|
||||
test.testTransform();
|
||||
test.tearDown();
|
||||
}
|
||||
|
||||
public final void testTransform() {
|
||||
|
||||
try {
|
||||
|
||||
String inFilename = filePath + "/JDK8022548.xml";
|
||||
String xslFilename = filePath + "/JDK8022548.xsl";
|
||||
String outFilename = filePath + "/JDK8022548.out";
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
// Create transformer factory
|
||||
TransformerFactory factory = TransformerFactory.newInstance();
|
||||
// set the translet name
|
||||
// factory.setAttribute("translet-name", "myTranslet");
|
||||
|
||||
// set the destination directory
|
||||
// factory.setAttribute("destination-directory", "c:\\temp");
|
||||
// factory.setAttribute("generate-translet", Boolean.TRUE);
|
||||
|
||||
// Use the factory to create a template containing the xsl file
|
||||
Templates template = factory.newTemplates(new StreamSource(new FileInputStream(xslFilename)));
|
||||
// Use the template to create a transformer
|
||||
Transformer xformer = template.newTransformer();
|
||||
// Prepare the input and output files
|
||||
Source source = new StreamSource(new FileInputStream(inFilename));
|
||||
Result result = new StreamResult(new FileOutputStream(outFilename));
|
||||
//Result result = new StreamResult(sw);
|
||||
// Apply the xsl file to the source file and write the result to the output file
|
||||
xformer.transform(source, result);
|
||||
|
||||
/**
|
||||
* String out = sw.toString(); if (out.indexOf("<p>") < 0 ) {
|
||||
* fail(out); }
|
||||
*/
|
||||
String canonicalizedFileName = outFilename + ".canonicalized";
|
||||
canonicalize(outFilename, canonicalizedFileName);
|
||||
} catch (Exception e) {
|
||||
// unexpected failure
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void canonicalize(String inName, String outName) {
|
||||
try (//FileOutputStream outStream = new FileOutputStream(outName);
|
||||
FileInputStream inputStream = new FileInputStream(inName);) {
|
||||
JDK15XML1_0Parser parser = new JDK15XML1_0Parser();
|
||||
parser.parse(new InputSource(inputStream));
|
||||
success("test passed");
|
||||
} catch (Exception e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JDK15XML1_0Parser extends SAXParser {
|
||||
|
||||
JDK15XML1_0Parser() throws org.xml.sax.SAXException {
|
||||
|
||||
super(new DTDConfiguration());
|
||||
// workaround for Java 1.5 beta 2 bugs
|
||||
com.sun.org.apache.xerces.internal.util.SecurityManager manager =
|
||||
new com.sun.org.apache.xerces.internal.util.SecurityManager();
|
||||
setProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY, manager);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user