Class AttributeValueTemplate

java.lang.Object
eu.bandm.tools.xslt.base.AttributeValueTemplate

public class AttributeValueTemplate extends Object
Parses an xslt "attribute value template" into an xpath expression with explicit string operations. So the follwing are equivalent xslt expressions (read [] for angle brackets):
   [x:y z="a{{bc{def(g)}" /]
        --->
   [x][xsl:attribute name="z" value="concat('a{bc', string(def(g))"][/x]
  
Iff syntax errors occur, error messages are sent and null is returned.
If no escape-curly-brace occurs, one single TPath.Literal is returned.
Otherwise one(1) TPath.FunctionCall to "string()" or to "concat()", on many of these both.
  • Field Details

  • Constructor Details

    • AttributeValueTemplate

      public AttributeValueTemplate()
  • Method Details

    • parse_tpath

      protected boolean parse_tpath()
      ATTENTION The "end element" semantic action at the end of the "braced expr" parsing method is fed into a sax event queue. The "enqueue()" function therein calls the "getlinenumber()" callback. This triggers a "get token = LT()", which causes the consumption on the character stream, which must be un-done, because after the xantlr lexer the hand-written code must consume the next chars without any loss.
    • flushBuffer

      protected void flushBuffer()
    • error

      protected void error(String s)
    • parse

      accumulate constant character data in Stringbuilder "konst" or call tpath parser. The results of both variants are zipped into "result" and at last combined in a call to string-concat, iff necessary.
    • main

      public static void main(String[] args)