XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] Getting XSD annotation from matched element

You might take a look at this XSLT function library provided with this
article, 

http://www.ibm.com/developerworks/library/x-schemanode/

You will find a set of XSLT functions that would allow you to locate the
schema component (the element declaration/type definition) for a given
instance node. 

Lisa




-----Original Message-----
From: David [mailto:dlee@calldei.com] 
Sent: Friday, August 13, 2010 5:54 AM
To: xml-dev@lists.xml.org
Subject: Re: [xml-dev] Getting XSD annotation from matched element

Thanks Michael.   The missing piece in my mind, suppose I used both 
saxon and xerces and load the schema twice.
How do I "match up" the current matched node with its corresponding 
schema element ?  My guess is I would have to 'understand' the schema as

well as saxon does to navigate to the right matching XSD node from 
xerces (yuck).   Simple cases may be easy but if the XSD has things like

derived types and groups it doesnt seem to me that obvious how I'd take 
a matched node and locate its coresponding entry in the schema.

I suspect this leads me down the path of some other 
(non-schema-annotation) direction such as something like schematron 
where I dont embed the annotations in the schema but instead in a 
axillary document which is easier to navigate.


Thanks.

-David


On 8/13/2010 8:44 AM, Michael Kay wrote:
> On 13/08/2010 13:11, David wrote:
>> Does anyone know, if in any XSLT or XQuery (or even Java) 
>> library/project/implementation if there is the following capibility.
>>
>> When using a Schema Aware transformation (or in java say a Schema 
>> Aware parser).
>> Given a matched node (in XSLT say a <template match="...">  or in 
>> XQuery or XSLT a variable referencing a node),
>> is there any method, either standard or proprietary, which can return

>> the annotation element from the XSD corresponding to that node ?
>>
>> The use case of this is I'd like to embed annotations in XSD and use 
>> them to control a transformation, and am not sure what tools I'm 
>> going to have to do to accomplish this.
>>
>> Thanks for any suggestions on where to look.
>>
>>
>
> Well, there's certainly nothing in the XSLT or XQuery spec that gives 
> access to any schema information beyond the type-name, let alone to 
> the annotations.
>
> In Saxon you could get most of the schema information from its 
> representation in an SCM file, which the schema processor can export -

> but not the annotations, which are discarded by the schema compiler. 
> You would have to do your own processing of the source schema
documents.
>
> Xerces provides programmatic access to its schema components, 
> including I believe the annotations, but that would mean (if using 
> Saxon) processing and loading the schema twice.
>
> Michael Kay
> Saxonica
>
>
_______________________________________________________________________
>
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
>
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php


-- 
David A. Lee
dlee@calldei.com
http://www.xmlsh.org


_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS