Graphics

 View Only
  • 1.  Xpath XML in Xpression Syntax Questions

    Posted 11-17-2016 23:20
    I'm trying to figure out how Xpression is querying my statcrew xml files within data link. It appears on the outside to be xpath but it doesn't quite work with how I know to write xpath statements. What i'm trying to do is for Basketball build a 5 on the floor stats full page graphic. I want Datalink to parse all information from statcrew when the operator takes the graphic to air. The code I'm typing into datalink that works so far is below.

    Column
    \team<2>\player\stats

    Row
    tp

    This returns total points for the first player that is currently listed as on the court from the visiting team. The trouble i'm running into is I can't figure out how to make it return the next 4 people. (i.e. the next result(s) under players on team 2 where on court = Y) Traditionally in xpath that script would look something like this.

    Column
    /bbgame/team[2]/player[@oncourt = "Y"][1]/stats

    Row
    tp

    In order to get the second player on court with the script above I would change the 1 to a 2. However, in Xpression, I can't figure out how to type this in where it will work.

    Any help would be greatly appreciated. I would love to see some documentation on this stuff if it's available.


  • 2.  RE: Xpath XML in Xpression Syntax Questions

    Posted 11-18-2016 00:24
    It may look like xpath, but it's really not. It has only a very limited syntax where it can search for a specific attribute or element with a given value (as you've shown in your first example).

    In the next release of XPression though (6.7, already available for beta users), there is support for running full XSLT transforms in the XML datalinq which should be able to do far more and can support any real xpath query.

    #XPression


  • 3.  RE: Xpath XML in Xpression Syntax Questions

    Posted 02-01-2018 20:21

    Hey Brian:

    ​I have an xml file structured as follows:

    <team division="Junior" name="Team 1">Team
    1</team>
    <team division="Senior" name="Team 2">Team 2</team>
    <team division="Junior" name="Team 3">Team 3
    </team>



    In v7.0 3798, is there a way to combine xpath queries in datalinq so that I can pull a specific team in a specific division? Something along these lines?

    ​Column: team<division=Junior><2>
    ​Row: name

    ​Should return:

    ​Team 3

    Thanks!

    CJ


    #XPression


  • 4.  RE: Xpath XML in Xpression Syntax Questions

    Posted 02-01-2018 21:28
    I've been looking in to this myself; like bford said, you're gonna need to investigate XLST; unfortunately the information online is a bit scattered. w3 schools isn't that helpful.

    That said, I have been able to pull the information from a basketball game to choose only players who are currently on the court. (Useful for starting lineups)
    Be careful though, when using XSLT, Xpression will only reveal the data that you've told your XLST file to pass through.
    #XPression


  • 5.  RE: Xpath XML in Xpression Syntax Questions

    Posted 02-02-2018 00:40
    Hey CJ,

    Actually you can do that particular query..

    The syntax is a bit weird but once you know it, you'll get it..

    Column: team>
    Row: name

    The <2> in side the query indicates it should return the 2nd element it finds that matches the query..

    XSLT could also do this (and way more powerful things too), but like Foxtrot says, it's quite a learning curve to figure out XSLT.
    #XPression


  • 6.  RE: Xpath XML in Xpression Syntax Questions

    Posted 02-02-2018 00:46

    And, an upcoming feature in 7.1 is to be able to search for data in children elements in the XML.. So for example, lets presume you have an XML schema like this

    Code:
    <xml>
       <teams>
          <team>
             <info>
                <name>Bears</name>
             </info>
             <stats>
                 <goals>10</goals>
             </stats>
          </team>
          <team>
             <info>
                <name>Bulls</name>
             </info>
             <stats>
                 <goals>50</goals>
             </stats>
          </team>
      </teams>

    In previous versions you would not be able to select the team based on the name because the name element was underneath another child (info) of the team element.
    In 7.1 and up the syntax would be like this.

    Column:teams\team<info.name=Bulls>\stats\goals

    The decimal in the search indicates to look for the "name" field within the "info" child.


    #XPression


  • 7.  RE: Xpath XML in Xpression Syntax Questions

    Posted 02-05-2018 17:51
    Thanks Guys! It sounds like I now need to teach myself XSLT, but for this project your method is working perfectly, Brian. Thank you!

    "‹CJ
    #XPression