470,811 Members | 1,136 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,811 developers. It's quick & easy.

Automatic XPath Query Generation

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 '06 #1
2 1650
ad*****@googlemail.com 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
Jun 24 '06 #2
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
Jun 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Rasmus Fogh | last post: by
8 posts views Thread by Terry P | last post: by
15 posts views Thread by Kannan Goundan | last post: by
2 posts views Thread by luke | last post: by
4 posts views Thread by Petterson Mikael | last post: by
3 posts views Thread by Jason Mobarak | last post: by
3 posts views Thread by =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.