Re: [xsl] an elements schema context via xslt

Subject: Re: [xsl] an elements schema context via xslt
From: Arian Hojat <arianhojat2000@xxxxxxxxx>
Date: Thu, 30 Jun 2005 09:31:15 -0700 (PDT)
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[@name=$var]"
 }
}

match="xsd:element"
{
if has @name, output "it can have this element "+@name
else if has @ref
 {
 $var = @ref
 apply templates select="/*//xsd:element[@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[@name=$var]"|
.//xsd:attribute"
 }
}

match="xsd:attribute"
{
output "It can have this attribute"+@name 
}





--- Jan Limpens <jan.limpens@xxxxxxxxx> 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
> 
> 


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

Current Thread