RE: [xsl] How to get a list of XPath out of XML schema documents

Subject: RE: [xsl] How to get a list of XPath out of XML schema documents
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 24 Feb 2005 08:46:14 -0000
Firstly, there's an infinite number of XPath expressions that select nodes
in any given document. Your example suggests you're only interested in a
subset of such paths: those that select elements, that are absolute path
expressions, that use the child axis only, that use NameTests, and that
contain no predicates.

Secondly, there's a problem with generating path expressions: namespaces. An
element in a non-null namespace can only be referenced in a path expression
by means of a QName that contains a prefix, and there is no way within the
path expression itself of binding the prefix to a specific URI. If the list
of path expressions is intended only for visual inspection this might not
matter, but if it's intended for use by software, then generating
expressions of the form

/*[local-name()="abc" and namespace-uri=""]/*[.....]

would be better.

Finally, the title of your post says you want to generate paths from a
schema, whereas the body of your post suggests you want to generate paths
from an instance document. I think you need to define your requirements
rather more clearly.

Michael Kay

> -----Original Message-----
> From: "Michael Lindenau (geschdftlich)"
> [mailto:michael.lindenau@xxxxxxxxxxxxxxxxxxxxxx]
> Sent: 24 February 2005 02:41
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] How to get a list of XPath out of XML schema documents
> Hi,
> I'm a newbie and I would like to figure out, how I can get a
> list of all
> XPath in an XML document via XLST.
> The list can have XML, HTML or CSV format. I'm only interested in all
> complete XPath expressions.
> Something like
> /doc/main/field
> /doc/main/field/id
> ...
> Are examples somewhere available. I searched through Google all night
> long with little success.
> Thanx in advance for any help
> --
> Kind regards
> Michael Lindenau
> Lvsungen+Ideen
> "Any problem in computer science can be solved with
> another layer of indirection. But that usually will
> create another problem!" <David Wheeler>
> mobile: +49 (0) 179 29 28 834
> e-mail: michael.lindenau@xxxxxxxxxxxxxxxxxxxxxx
> -------------------------------------------------------
> Lvsungen+Ideen
> Alejandro Puskin No 1, Portal H, 5C
> 29011 Malaga
> ES - Espaqa
> -------------------------------------------------------
> This email is confidential. If you are not the intended
> recipient, you must not disclose or use the information
> contained in it. If you have received this mail in error,
> please tell me immediately by return email and delete
> the document.

Current Thread