Re: [xsl] Access to RowsetSchema attribute

Subject: Re: [xsl] Access to RowsetSchema attribute
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 23 Oct 2001 14:47:26 +0100
Hi Gurnandan,

> Using the following xml fragment, I need to get the value of
> rs:dbtype attribute, assuming that the current context is positioned
> at the attribute z:row/@c1. How do I do it?

Presumably you want to know the data type of the c1 attribute? To get
that you need the value of the rs:dbtype attribute:

  @rs:dbtype

on the s:datatype element:

  s:datatype/@rs:dbtype

under the s:AttributeType element whose name attribute is 'c1':

  s:AttributeType[@name = 'c1']/s:datatype/@rs:dbtype

within the s:ElementType within the s:Schema within the 'xml' [sic]
document element:

 /xml/s:Schema/s:ElementType
   /s:AttributeType[@name = 'c1']/s:datatype/@rs:dbtype

If you don't know the name of the attribute that you want to find the
data type for, then you can use the name() function on the current
attribute to get it, which would make the path:

 /xml/s:Schema/s:ElementType
   /s:AttributeType[@name = name(current())]/s:datatype/@rs:dbtype

If there are lots of s:ElementType elements within the s:Schema, then
you want to choose the one whose name attribute is the same as the
name of the parent of the current attribute node:

 /xml/s:Schema/s:ElementType[@name = name(current()/..)]
   /s:AttributeType[@name = name(current())]/s:datatype/@rs:dbtype

If you're doing this a lot, you might want to set up a key so that you
can quick access to the relevant s:AttributeType element.
   
I hope that's the kind of thing you were after,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread