Menu

XPath and user variables

2008-07-28
2013-05-15
  • Roger I Martin

    Roger I Martin - 2008-07-28

    Hi Jimmy,

    This is an exciting development.  There was a wssg at google code that was to implement vtd but their svn is empty.

    I've been exploring and testing; testing with tested xml and xsl documents.

    1) An XPath of "$index - 1" fails on the select xpath phase.  Looking through the parser generation I see a VariableReference with a DOLLAR NAME grammar for it but its apparently not happening.  The other thing the scanner.flex and the code doesn't look like there is a a way for the user to set or get their values.  I was attempting to add this functionality. 

    2) I assume ximple-dev is the most current cvs module?  (I tried a number but it seemed the most up to date) )There are compile issues related to the two exceptions; com.ximpleware.XPathEvalException and com.ximpleware.xpath.XPathEvalException, particularly the Expr based classes.  The imports needed some adjustment.  Also if Expr is not planned to hold code, it could be an interface rather than an abstract class?

    3) What is the XPath 2.0 state of implementation?  Can parser constructors and lexical analysers complete the implementation? What other areas of implementation do you see on your todo list?

     
    • jimmy zhang

      jimmy zhang - 2008-08-05

      Hi, Sorry for the late reply, Sourceforge is undergoing some sort of upgrade, I guess.

      You just have to remove those two classes

      com.ximpleware.xpath.XPathEvalException
      and
      com.ximpleware.XPathEvalException

      as they have been moved into com.ximpleware

      Can you elaborate on the $index - 1? you are correct that the variable expression isn't implmeneted yet... but I haven't seen much use for this... can you point me to those cases?

      We are looking at XPath 2.0, this is definitely on our roadmap...

      you are welcome to join the discussion list (vtd-xml-users or user-xml-dev) to further our discussion

       
    • Roger I Martin

      Roger I Martin - 2008-08-06

      ok, I'll join the lists, thanks.

      Yea, there isn't much use but I was exploring using vtd with small sub xslt; like translets.  For situations where we know what needs to be transformed and a big generic, all-the-spec engine need not be applied. (Can also avoid collisions of xalan and saxon in large projects)

      The parser.cup has
      VariableReference ::= DOLLAR NAME   
                ;

      but it doesn't appear to take action.

      Example:
      ........
          <xsl:template match="Scene" name="scene">
              <xsl:param name="index" select="0"/>
              <xsl:for-each select="*">
              <xsl:if test="not(local-name()='ProtoDeclare')">
              <xsl:apply-templates select="."><xsl:with-param name="index" select="$index + position() - 1"/><xsl:with-param name="current-group" select="string('sceneScale')"/>
                      </xsl:apply-templates>
              </xsl:if>
              </xsl:for-each>
             
              </xsl:template>
      ........
      where the with-param needs to pass index calculations for child elements.

      I was reading in a xsl doc with vtd-xml and controlling a transform of xml docs(parsed by vtd-xml) and spitting out text files.

      Particularly transforming cml(chemical markup) x3d-neuralworks (modified schema of x3d of www.web3d.org) to osg (open scene graph) format.  There are a bunch of other transforms I have I'm testing such as mathml2Java source code.

      The x3d-neuralworks.xsd is according to xmlns:xsd="http://www.w3.org/2001/XMLSchema" while x3d-3.0.xsd is a broken schema. x3d-neuralworks.xsd  is also modified to accept binary numerical arrays as element content.  Made a modified vtd-xml that also parses these mixed binary xml docs.

      Then to read(and eventually edit) I gutted http://pollo.sourceforge.net/ of all dom and sax and modified it to use vtd-xml as its parser.  It is a viewer at this point because it was based also on the dom event (http://www.w3.org/TR/DOM-Level-2-Events/) which I haven't found a way to replace yet.

      After joining the lists I'll put examples of these explorations up and update the https://sourceforge.net/projects/mathml-x/ with its xsd's and xsl's.

       
    • jimmy zhang

      jimmy zhang - 2008-08-10

      Mathml-xml doesn't have the page up for visiting yet, it seems...

      XSL translet is an interesting concept...

      would you be interested in helping work on the variable expression implementation?

       

Log in to post a comment.