Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Automatic XPath Query Generation

Reply
Thread Tools

Automatic XPath Query Generation

 
 
adnw747@googlemail.com
Guest
Posts: n/a
 
      06-24-2006
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

 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      06-24-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      06-26-2006
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/developerwork...ss1/index.html
http://www-128.ibm.com/developerwork...ss2/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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New XPath Generation Tool ziggyware@gmail.com XML 4 08-14-2006 02:14 AM
Template language with XPath support for source code generation? Stefan Behnel Python 3 01-13-2006 02:01 PM
xpath query query David Gordon XML 2 05-18-2005 03:33 PM
XPATH generation from Schema Bart Torbert XML 0 02-03-2004 09:50 PM
HTML Generation (Next Generation CGI) John W. Long Ruby 4 11-24-2003 04:24 AM



Advertisments