You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Timm, Sean" <ST...@mailgo.com> on 2000/01/28 01:18:41 UTC

[PATCH] xsl:stylesheet requires 'version' attribute

Index: StylesheetHandler.java
===================================================================
RCS file:
/home/cvspublic/xml-xalan/src/org/apache/xalan/xslt/StylesheetHandler.java,v
retrieving revision 1.13
diff -u -r1.13 StylesheetHandler.java
--- StylesheetHandler.java	2000/01/24 16:55:06	1.13
+++ StylesheetHandler.java	2000/01/28 00:16:28
@@ -566,7 +566,8 @@
           m_stylesheet.getTemplateList().setIsWrapperless(false);
           m_foundStylesheet = true;
           int nAttrs = atts.getLength();
-          boolean didSpecifiyIndent = false;
+          // Not currently used - boolean didSpecifyIndent = false;
+          boolean didSpecifyVersion = false;
           for(int i = 0; i < nAttrs; i++)
           {
             String aname = atts.getName(i);
@@ -613,6 +614,7 @@
             {
               String versionStr = atts.getValue(i);
               m_stylesheet.m_XSLTVerDeclared =
Double.valueOf(versionStr).doubleValue();
+              didSpecifyVersion = true;
             }
             else if(!(isAttrOK(aname, atts, i) || processSpaceAttr(aname,
atts, i)))
             {
@@ -627,6 +629,11 @@
               m_stylesheet.m_namespaceDecls =
(org.apache.xalan.xpath.xml.NameSpace)m_stylesheet.m_namespaces.peek();
             }
 
+            if(!didSpecifyVersion)
+            {
+              throw new
SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_STYLESHEET_REQU
IRES_VERSION_ATTRIB, null)); // "xsl:stylesheet requires a 'version'
attribute!");
+            }
+            
             /*
             default:
             if((null != ns) &&
(ns.equalsIgnoreCase(m_processor.m_XSLNameSpaceURL) || 
Index: XSLTErrorResources.java
===================================================================
RCS file:
/home/cvspublic/xml-xalan/src/org/apache/xalan/xslt/res/XSLTErrorResources.j
ava,v
retrieving revision 1.11
diff -u -r1.11 XSLTErrorResources.java
--- XSLTErrorResources.java	2000/01/19 17:56:36	1.11
+++ XSLTErrorResources.java	2000/01/28 00:16:48
@@ -20,7 +20,7 @@
 public static final String ERROR_SUFFIX = "ER";  
 public static final String WARNING_SUFFIX = "WR";
 
-public static final int MAX_CODE = 91;                  // this is needed
to keep track of the number of messages          
+public static final int MAX_CODE = 92;                  // this is needed
to keep track of the number of messages          
 public static final int MAX_WARNING = 22;             // this is needed to
keep track of the number of warnings
 public static final int MAX_OTHERS = 41;
 public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING +1;
@@ -514,6 +514,11 @@
 public static final int ER_MALFORMED_FORMAT_STRING = 91;
 static {contents[ER_MALFORMED_FORMAT_STRING][1] 
           = "Malformed format string: {0}";
+}
+
+public static final int ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = 92;
+static {contents[ER_STYLESHEET_REQUIRES_VERSION_ATTRIB][1] 
+          = "xsl:stylesheet requires a 'version' attribute!";
 }
 
 // Warnings...