Transform XSLT using Xalan in secure processing mode into XHTML

"Kazakov, Victor D" <[email protected]> Tue, 12 Aug 2014 21:19:27 +0000
Newsgroups gmane.text.xml.xalan.java.user
Message-ID <[email protected]>
--_004_FCD5EF9C38733F439BB15E72023A9BB60B5A5DUSLIMS113Ccacom_
Content-Type: multipart/alternative;
	boundary="_000_FCD5EF9C38733F439BB15E72023A9BB60B5A5DUSLIMS113Ccacom_"

--_000_FCD5EF9C38733F439BB15E72023A9BB60B5A5DUSLIMS113Ccacom_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,
I'm trying to use the updated version of Xalan (2.7.2) in secure mode and h=
aving issue with it not able to understand unknown attributes. The problem =
is, it prevents you from using any stylesheet that emits XHTML (in secure p=
rocessing mode) because it disallows things like "colspan" attributes of "t=
h" elements.

The associated changed file is here: http://svn.apache.org/viewvc/xalan/jav=
a/branches/xalan-j_2_7_1_maint/src/org/apache/xalan/processor/XSLTElementPr=
ocessor.java?r1=3D1359736&r2=3D1581058&pathrev=3D1581058&diff_format=3Dh

See the attached example.
It returns this error:
Exception in thread "main" javax.xml.transform.TransformerConfigurationExce=
ption: javax.xml.transform.TransformerException: org.xml.sax.SAXException: =
"colspan" attribute is not allowed on the th element!
javax.xml.transform.TransformerException: "colspan" attribute is not allowe=
d on the th element!

Am I doing something wrong with the stylesheet or am I missing setting a fe=
ature on the transformer factory. How would you transform a stylesheet that=
 emits (X)HTML in secure processing mode using Xalan?

Thanks,


Victor Kazakov
Sr Software Engineer

CA Technologies | Suite 500, HSBC Building | 885 West Georgia Street | Vanc=
ouver, BC, Canada, V6C 3G1
Office: +1 604 235 8398 | [email protected]



--_000_FCD5EF9C38733F439BB15E72023A9BB60B5A5DUSLIMS113Ccacom_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" xmlns:m=3D"http://schema=
s.microsoft.com/office/2004/12/omml" xmlns=3D"http://www.w3.org/TR/REC-html=
40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"#0563C1" vlink=3D"#954F72">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Hi,<o:p></o:p></p>
<p class=3D"MsoNormal">I'm trying to use the updated version of Xalan (2.7.=
2) in secure mode and having issue with it not able to understand unknown a=
ttributes. The problem is, it prevents you from using any stylesheet that e=
mits XHTML (in secure processing mode)
 because it disallows things like &#8220;colspan&#8221; attributes of &#822=
0;th&#8221; elements.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">The associated changed file is here: <a href=3D"http=
://svn.apache.org/viewvc/xalan/java/branches/xalan-j_2_7_1_maint/src/org/ap=
ache/xalan/processor/XSLTElementProcessor.java?r1=3D1359736&amp;r2=3D158105=
8&amp;pathrev=3D1581058&amp;diff_format=3Dh">
http://svn.apache.org/viewvc/xalan/java/branches/xalan-j_2_7_1_maint/src/or=
g/apache/xalan/processor/XSLTElementProcessor.java?r1=3D1359736&amp;r2=3D15=
81058&amp;pathrev=3D1581058&amp;diff_format=3Dh</a><o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">See the attached example.<o:p></o:p></p>
<p class=3D"MsoNormal">It returns this error:<o:p></o:p></p>
<p class=3D"MsoNormal">Exception in thread &quot;main&quot; javax.xml.trans=
form.TransformerConfigurationException: javax.xml.transform.TransformerExce=
ption: org.xml.sax.SAXException: &quot;colspan&quot; attribute is not allow=
ed on the th element!<o:p></o:p></p>
<p class=3D"MsoNormal">javax.xml.transform.TransformerException: &quot;cols=
pan&quot; attribute is not allowed on the th element!<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Am I doing something wrong with the stylesheet or am=
 I missing setting a feature on the transformer factory. How would you tran=
sform a stylesheet that emits (X)HTML in secure processing mode using Xalan=
?<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Thanks,<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><b>Victor Kazakov<o:p></o:p></b></p>
<p class=3D"MsoNormal">Sr Software Engineer<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt">CA Technologies | S=
uite 500, HSBC Building | 885 West Georgia Street | Vancouver, BC, Canada, =
V6C 3G1<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt">Office: &#43;1 604 =
235 8398 | <a href=3D"[email protected]">
<span style=3D"color:blue">[email protected]</span></a><o:p></o:p></spa=
n></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>

--_000_FCD5EF9C38733F439BB15E72023A9BB60B5A5DUSLIMS113Ccacom_--

--_004_FCD5EF9C38733F439BB15E72023A9BB60B5A5DUSLIMS113Ccacom_
Content-Type: application/octet-stream;
	name="XalanSecureAttributeRepro.java"
Content-Description: XalanSecureAttributeRepro.java
Content-Disposition: attachment; filename="XalanSecureAttributeRepro.java";
	size=1201; creation-date="Tue, 12 Aug 2014 21:14:27 GMT";
	modification-date="Tue, 12 Aug 2014 21:14:27 GMT"
Content-Transfer-Encoding: base64

aW1wb3J0IGphdmF4LnhtbC5YTUxDb25zdGFudHM7DQppbXBvcnQgamF2YXgueG1sLnRyYW5zZm9y
bS4qOw0KaW1wb3J0IGphdmF4LnhtbC50cmFuc2Zvcm0uc3RyZWFtLlN0cmVhbVNvdXJjZTsNCmlt
cG9ydCBqYXZhLmlvLlN0cmluZ1JlYWRlcjsNCg0KcHVibGljIGNsYXNzIFhhbGFuU2VjdXJlQXR0
cmlidXRlUmVwcm8gew0KICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBYU0wgPQ0KICAg
ICAgICAgICAgIjx4c2w6c3R5bGVzaGVldCB2ZXJzaW9uPVwiMS4wXCIgeG1sbnM6eHNsPVwiaHR0
cDovL3d3dy53My5vcmcvMTk5OS9YU0wvVHJhbnNmb3JtXCI+XG4iICsNCiAgICAgICAgICAgICIg
IDx4c2w6b3V0cHV0IG1ldGhvZD1cImh0bWxcIi8+XG4iICsNCiAgICAgICAgICAgICIgIDx4c2w6
dGVtcGxhdGUgbW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