Automatic XPath Query Generation

Discussion in 'XML' started by adnw747@googlemail.com, Jun 24, 2006.

  1. Guest

    Hi All

    I am trying to generate an XPath expression based on a xml input. The
    generated XPath expression should then allow me find/detect that input
    xml code fragment is present within a larger document. Can this be done
    with XSLT?

    I'm not looking for a full solution to this problem just some pointers
    in the right direction.

    thanks
    , Jun 24, 2006
    #1
    1. Advertising

  2. wrote:
    > Hi All
    >
    > I am trying to generate an XPath expression based on a xml input. The
    > generated XPath expression should then allow me find/detect that input
    > xml code fragment is present within a larger document. Can this be done
    > with XSLT?


    A template for generating basic XPaths was one of the incidental things
    I included in my "Styling Stylesheets" articles on IBM's DeveloperWorks
    website's XML section (http://www.ibm.com/xml). As I noted there, it
    cheats somewhat, in that it isn't handling namespaces properly. Since
    then, I realized that I could solve that by using predicates... but the
    resulting XPaths would not be very human-readable.

    (Part of the problem is that XPath itself doesn't have any standard
    syntax for defining prefixes, which is somewhat annoying.)


    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Jun 24, 2006
    #2
    1. Advertising

  3. Joe Kesselman wrote:
    > A template for generating basic XPaths was one of the incidental things
    > I included in my "Styling Stylesheets" articles on IBM's DeveloperWorks
    > website's XML section (http://www.ibm.com/xml). As I noted there, it
    > cheats somewhat, in that it isn't handling namespaces properly. Since
    > then, I realized that I could solve that by using predicates... but the
    > resulting XPaths would not be very human-readable.


    For convenience, the two-part article can be found at
    http://www-128.ibm.com/developerworks/xml/library/x-styless1/index.html
    http://www-128.ibm.com/developerworks/xml/library/x-styless2/index.html

    The pseudo-XPath generator template is in part 2; see listing 4.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Jun 26, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chishun Kwong
    Replies:
    2
    Views:
    414
    Eduardo Francos
    Sep 17, 2003
  2. Simon Begin

    Automatic Index generation

    Simon Begin, Jan 28, 2005, in forum: HTML
    Replies:
    3
    Views:
    1,851
    Bob Long
    Feb 3, 2005
  3. David Gordon

    xpath query query

    David Gordon, May 18, 2005, in forum: XML
    Replies:
    2
    Views:
    781
    David Gordon
    May 18, 2005
  4. Andrei Alexandrescu \(See Website for Email\)

    Re: Automatic C++ header generation?

    Andrei Alexandrescu \(See Website for Email\), Nov 25, 2004, in forum: C++
    Replies:
    0
    Views:
    510
    Andrei Alexandrescu \(See Website for Email\)
    Nov 25, 2004
  5. John W. Long

    HTML Generation (Next Generation CGI)

    John W. Long, Nov 22, 2003, in forum: Ruby
    Replies:
    4
    Views:
    319
    John W. Long
    Nov 24, 2003
Loading...

Share This Page