sboag 01/07/13 12:35:16
Modified: java/src/org/apache/xalan/serialize SerializerToHTML.java
Log:
Application of patch submitted by Benjamin Riefenstahl
<[EMAIL PROTECTED]>
Motivation: We are using Xalan to generate HTML pages. We have the
requirement to integrate code for ad banners. The ad server provider
has written the code to use with compatibility to NetScape 4 in mind.
The code uses the NetScape proprietory <LAYER> element and <IFRAME>
elements for other browsers. The SRC attributes of these elements
contain URLs with several URL parameters separated by '&', as is the
common convention.
Problem: The code is integrated in our XSL stylesheets. In the
stylesheet the '&' has to be written as the entity '&'. That's
ok. The problem is that in the output the '&' is also written as
'&' which is not ok, because NetScape doesn't understand that.
OTOH the same URL is written with '&' when used in an <A> element.
Solution: This goes down to a different handling of attribute values
in the class SerializeToHTML, depending on whether the attribute in
question is known to contain a URI or not. Xalan knows this for <A>
but not for <LAYER> and <IFRAME>. When I compare the list in
SerializeToHTML.java with the HTML specs, I find a couple of other
missing URI attributes in SerializeToHTML.java. When I add the
missing pieces, the generation works fine.
Patch: Here is the patch (diff -c) for xalan-j_2_2_D6. I also have
one for xalan-j_2_0_1 which is the version I actually tested this
with. Please let me know if this is insufficient or the patch is
wrong or if there is something else I can do to fix this problem.
Revision Changes Path
1.8 +36 -1
xml-xalan/java/src/org/apache/xalan/serialize/SerializerToHTML.java
Index: SerializerToHTML.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/serialize/SerializerToHTML.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SerializerToHTML.java 2001/07/05 18:08:29 1.7
+++ SerializerToHTML.java 2001/07/13 19:35:13 1.8
@@ -282,7 +282,19 @@
// From "John Ky" <[EMAIL PROTECTED]
m_elementFlags.put("NOBR", new ElemDesc(0 | ElemDesc.FONTSTYLE));
-
+
+ // HTML 4.0, section 16.5
+ m_elementFlags.put("IFRAME",
+ new ElemDesc(0 | ElemDesc.BLOCK |
ElemDesc.BLOCKFORM
+ |
ElemDesc.BLOCKFORMFIELDSET));
+ // NS4 extensions
+ m_elementFlags.put("LAYER",
+ new ElemDesc(0 | ElemDesc.BLOCK |
ElemDesc.BLOCKFORM
+ |
ElemDesc.BLOCKFORMFIELDSET));
+ m_elementFlags.put("ILAYER",
+ new ElemDesc(0 | ElemDesc.BLOCK |
ElemDesc.BLOCKFORM
+ |
ElemDesc.BLOCKFORMFIELDSET));
+
ElemDesc elemDesc;
elemDesc = (ElemDesc) m_elementFlags.get("AREA");
@@ -314,6 +326,9 @@
elemDesc.setAttr("HREF", ElemDesc.ATTRURL);
elemDesc.setAttr("NAME", ElemDesc.ATTRURL);
+
+ elemDesc = (ElemDesc) m_elementFlags.get("LINK");
+ elemDesc.setAttr("HREF", ElemDesc.ATTRURL);
elemDesc = (ElemDesc) m_elementFlags.get("INPUT");
@@ -379,6 +394,26 @@
// Attribution to: "Voytenko, Dimitry" <[EMAIL PROTECTED]>
elemDesc = (ElemDesc) m_elementFlags.get("FRAME");
+
+ elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
+ elemDesc.setAttr("LONGDESC", ElemDesc.ATTRURL);
+
+ // HTML 4.0, section 16.5
+ elemDesc = (ElemDesc) m_elementFlags.get("IFRAME");
+
+ elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
+ elemDesc.setAttr("LONGDESC", ElemDesc.ATTRURL);
+
+ // NS4 extensions
+ elemDesc = (ElemDesc) m_elementFlags.get("LAYER");
+
+ elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
+
+ elemDesc = (ElemDesc) m_elementFlags.get("ILAYER");
+
+ elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
+
+ elemDesc = (ElemDesc) m_elementFlags.get("DIV");
elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]