[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: XPath: how to select based on element type?
- From: Matt Sergeant <firstname.lastname@example.org>
- To: Sankaranarayanan K V <email@example.com>
- Date: Mon, 08 Jan 2001 11:43:38 +0000 (GMT)
On Mon, 8 Jan 2001, Sankaranarayanan K V wrote:
> On Mon, Jan 08, 2001 at 10:33:26AM +0000, Matt Sergeant wrote:
> > On Mon, 8 Jan 2001, Sankaranarayanan K V wrote:
> > > (1) Is there a way a in XPath to select nodes based on their element type?
> > Element type is not a term I recognise. Perhaps you either mean node type
> > or element name. Either way:
> By "element type," I meant the value of the 'type' attribute in the
> element declaration (in the schema) for the element. That type which is
> declared using the xsd:simpleType or xsd:complexType elements in the
> schema definition.
> I didn't mean the node type or element name.
> To give an example:
> I want to pick up all elements of type 'Address' from the following
> where WorkAddress and HomeAddress may be of type Address in the schema
XPath has no understanding of XML Schemas. Sorry, but you are out of luck
on this one.
You *could* potentially do something with document(), loading in the
schema and reading the "type" from that and comparing it with name(), but
its certainly not a standard operation.
Also note that document() isn't a core XPath function, but a function
added to XPath by XSLT, so it might not be available depending on your
XPath implementation - a moot point if you're talking about using XPath
from within XSLT.
/|| ** Director and CTO **
//|| ** AxKit.com Ltd ** ** XML Application Serving **
// || ** http://axkit.org ** ** XSLT, XPathScript, XSP **
// \\| // ** Personal Web Site: http://sergeant.org/ **