morten      01/11/08 03:38:19

  Modified:    java/src/org/apache/xalan/xsltc/compiler Sort.java
               java/src/org/apache/xalan/xsltc/compiler/util
                        ErrorMessages.java ErrorMessages_no.java
                        ErrorMsg.java
  Log:
  Added a test to verify that <xsl:sort/> elements are only used within
  <xsl:apply-templates/> or <xsl:for-each/> elements.
  PR:           n/a
  Obtained from:        n/a
  Submitted by: [EMAIL PROTECTED]
  Reviewed by:  [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.10      +9 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Sort.java
  
  Index: Sort.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Sort.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Sort.java 2001/11/05 13:51:58     1.9
  +++ Sort.java 2001/11/08 11:38:18     1.10
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Sort.java,v 1.9 2001/11/05 13:51:58 morten Exp $
  + * @(#)$Id: Sort.java,v 1.10 2001/11/08 11:38:18 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -97,6 +97,14 @@
        * Parse the attributes of the xsl:sort element
        */
       public void parseContents(Parser parser) {
  +
  +     final SyntaxTreeNode parent = getParent();
  +     if (!(parent instanceof ApplyTemplates) &&
  +         !(parent instanceof ForEach)) {
  +         reportError(this, parser, ErrorMsg.STRAY_SORT_ERR, null);
  +         return;
  +     }
  +
        // Parse the select expression (node string value if no expression)
        _select = parser.parseExpression(this, "select", "string(.)");
   
  
  
  
  1.4       +6 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages.java
  
  Index: ErrorMessages.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ErrorMessages.java        2001/10/30 15:57:38     1.3
  +++ ErrorMessages.java        2001/11/08 11:38:18     1.4
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: ErrorMessages.java,v 1.3 2001/10/30 15:57:38 morten Exp $
  + * @(#)$Id: ErrorMessages.java,v 1.4 2001/11/08 11:38:18 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -244,7 +244,11 @@
        "         with the -j option.\n" +
        "   Notes:\n"+
        "         The -x option switches on debug messages.\n"+
  -     "         The -s option disables calling System.exit."
  +     "         The -s option disables calling System.exit.",
  +
  +     // STRAY_SORT_ERR
  +     "<xsl:sort> can only be used within <xsl:for-each> or 
<xsl:apply-templates>."
  +
       };
   
       private static Vector _keys;
  
  
  
  1.4       +6 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_no.java
  
  Index: ErrorMessages_no.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_no.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ErrorMessages_no.java     2001/10/31 07:29:39     1.3
  +++ ErrorMessages_no.java     2001/11/08 11:38:18     1.4
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: ErrorMessages_no.java,v 1.3 2001/10/31 07:29:39 morten Exp $
  + * @(#)$Id: ErrorMessages_no.java,v 1.4 2001/11/08 11:38:18 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -244,7 +244,11 @@
        "         <arkiv> er en JAR-fil som klassen leses fra.\n"+
        "   Annet:\n"+
        "         -x sl\u00e5r p\u00e5 debug meldinger.\n"+
  -     "         -s blokkerer alle kall til System.exit()."
  +     "         -s blokkerer alle kall til System.exit().",
  +
  +     // STRAY_SORT_ERR
  +     "<xsl:sort> kan bare brukes under <xsl:for-each> eller 
<xsl:apply-templates>."
  +
       };
   
       public Object handleGetObject(String key) {
  
  
  
  1.11      +4 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java
  
  Index: ErrorMsg.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ErrorMsg.java     2001/10/30 16:19:45     1.10
  +++ ErrorMsg.java     2001/11/08 11:38:18     1.11
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: ErrorMsg.java,v 1.10 2001/10/30 16:19:45 morten Exp $
  + * @(#)$Id: ErrorMsg.java,v 1.11 2001/11/08 11:38:18 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -161,6 +161,9 @@
       public static final int COMPILE_STDIN_ERR       = 71;
       public static final int COMPILE_USAGE_STR       = 72;
       public static final int TRANSFORM_USAGE_STR     = 73;
  +
  +    // Recently added error messages
  +    public static final int STRAY_SORT_ERR          = 74;
   
       // All error messages are localized and are stored in resource bundles.
       // This array and the following 4 strings are read from that bundle.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to