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 escaping-curly-brace occurs, one single TPath.Literal is returned. Otherwise one(1) TPath.FunctionCall to "string()" or to "concat()", on multiple of these both.

Each instance is a one-usage-only parser.

  • 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 a tpath parser. Both operate on the same CharBuffer and share its read pointer. The results of both cases are zipped into "result" and finally combined in a call to tpath »string-concat()«, iff necessary.
    • main

      public static void main(String[] args)