xsl-list
[Top] [All Lists]

Re: an elements schema context via xslt

2005-06-30 09:31:15
Hey,
Couldn't you apply an xsl on just the schema doc?
prob alot more complex than this. Especially if you
split it up into many xsd's then I am not sure to
check ALL the documents via document() for matches. 
But this is my best guess (and I stink at guessing
hehe).

Psuedocode:

I use // cause of all the choice and sequence elements
that might parent the nodes.

match="xsd:group"
{
if has @name
apply templates select="//xsd:element"
else if has @ref
 {
 $var = @ref
 apply templates select="//xsd:group[(_at_)name=$var]"
 }
}

match="xsd:element"
{
if has @name, output "it can have this element "+(_at_)name
else if has @ref
 {
 $var = @ref
 apply templates select="/*//xsd:element[(_at_)name=$var] |
.//xsd:group"
 apply templates
select="xsd:attribute|xsd:attributeGroup"
 }
}

match="xsd:attributeGroup"
{
if has @name
apply-templates select="/*//xsd:attributeGroup |
.//xsd:attribute"
else if has @ref
{
 $var = @ref
 apply-templates
select="/*//xsd:attributeGroup[(_at_)name=$var]"|
.//xsd:attribute"
 }
}

match="xsd:attribute"
{
output "It can have this attribute"+(_at_)name 
}





--- Jan Limpens <jan(_dot_)limpens(_at_)gmail(_dot_)com> wrote:

Hi everyone,

I wonder if it is possible (with a reasonable amount
of code) to find
out (given a xml document, the xpath to an element
in this doc and the
schema (xsd) document upon which the document is/was
created), to find
out which are the possible child- (and sibling- and
attribute-)
elements for the given element - using xslt. I am
building a web based
xml source editor for xml files and would like to
provide some
intellisense - alike functionality.

I am using the .net xslt transformer, but could also
use the saxon.net
port if that would help in this situation.

If I am just missing something simple to do this
imperatively (by
coding c#), I'd be also happy to hear. :)

Thanks a lot

-- 
Jan
http://www.limpens.com

Otakoo Saloon Cartoon - newest episode at
http://otakoo-saloon-cartoon.com


--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>