[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xml inheritance / xslt inheritance application

Subject: Re: xml inheritance / xslt inheritance application
From: "Greg Fausak" <lgfausak@xxxxxxxxx>
Date: Tue, 17 Jun 2008 15:08:37 -0500
Re:  xml inheritance / xslt inheritance application
On Tue, Jun 17, 2008 at 2:49 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>
> Assuming XSLT 2.0, with a global variable $default set to the <default>
> element, and <column> as the context node, you can access an attribute such
> as "type" using
>
> (@type, $default/column[@name=current()/@name]@type)[1]
>

I don't quite understand.  This returns a nodeset with at least one @type,
perhaps 2 (if there is a default type).  [1] indexes the nodeset?  Does
indexing start at 0?  If so, if the 1th element isn't there does it
just reference
the nearest one?

I'm going to play with this a bit.  Thanks!
-g


> which might help. If the construct occurs often enough you can wrap it in a
> function.
>
> Michael Kay
> http://www.saxonica.com/
>
>
>
>> -----Original Message-----
>> From: Greg Fausak [mailto:lgfausak@xxxxxxxxx]
>> Sent: 17 June 2008 20:22
>> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>> Subject:  xml inheritance / xslt inheritance application
>>
>> I'm not sure if this is the right group for this question.
>> But, here it goes.
>>
>> I've modeled a xslt translation from a trivial xml syntax to
>> postgres.  One of the problems I've run in to is the database
>> column belongs to a table, e.g.:
>> <table name="test">
>>   <column name="col1" type="int" size="5" minvalue="50"
>> maxvalue="10000"/>
>>   <column name="col2" type="text" size="50" notnull="true"/> </table>
>>
>> etc..
>>
>> however, in databaseland, the column is often a domain
>> descended from another tree.  For example, the column could
>> be 'studentid' and that student id could be used in many
>> different tables because it is a foreign key.
>>
>> So, in my source xml, I've introduced
>> <default>
>>   <column name="col1" type="int" .../>
>> ...
>> and I changed the table xml to:
>> <table name="test">
>>   <column inherit="col1" minvalue="60" />
>>
>> So, I translate this, but, it sure would be nice if I could
>> inherit the attributes and nodes of the default column name
>> and override what I want locally.  Does such a construct
>> exist either on xsl side or xml side?
>>
>> I did some google searches on inheritance/subtyping and there
>> seem to be pretty strong opinions about the subject.
>> Worst case I can do a pre-pass on the xml text and use a
>> heredoc to expand this sort of thing.  Any ideas would be welcome!
>>
>> Thanks,
>>
>> ---greg
>>
>> --
>> Greg Fausak
>> greg@xxxxxxxxxxxx
>
>



-- 
Greg Fausak
greg@xxxxxxxxxxxx

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.