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

RE: increment pattern for an attribute..

  • From: dave <ceek63@y...>
  • To: Michael Kay <mike@s...>, xml-dev@l...
  • Date: Tue, 6 Nov 2007 13:10:49 -0800 (PST)

RE:  increment pattern for an attribute..

Well, now I am! 
Thanks for the tip. Appreciate it.
+D
--- Michael Kay <mike@s...> wrote:

>  
> > 
> > I use W3C XML schema language 1.0.
> 
> Well, I assumed you were aware that what you are
> asking for is well beyond
> the expressive power of XSDL 1.0.
> 
> Michael Kay
> http://www.saxonica.com/
> 
> 
> > 
> > --- Michael Kay <mike@s...> wrote:
> > 
> > > You don't say what technology you are using to
> define the 
> > schema. But 
> > > let's assume it's XSDL 1.1 with assertions (and
> with no 
> > limits on the 
> > > XPath syntax allowed in assertions) - as
> implemented in Saxon 9.0.
> > > 
> > > Then I think you can do it with
> > > 
> > > <xs:complexType name="type-of-data-element">
> > >   ...
> > >   <xs:assert test="e1[1]/@val=20 and 
> > >   every $e in e1[position()>1] satisfies $e/@val
> = 
> > > $e/preceding-sibling::e1/@val + 1"/>
> </xs:complexType>
> > > 
> > > I'm not sure this is quite right according to
> your description - 
> > > perhaps you allow gaps in the numbering
> sequence. In that case
> > > it's:
> > > 
> > > <xs:assert test="e1[1]/@val=20 and
> > > every $e in e1[position()>1] satisfies $e/+@val
> > 
> > > $e/preceding-sibling::e1/+@val"/>
> > > 
> > > (The odd little "+" signs are a quirky way of
> forcing 
> > conversion to a 
> > > number in XPath 2.0)
> > > 
> > > Give it a try and let us know if it works.
> > > 
> > > Michael Kay
> > > http://www.saxonica.com/
> > > 
> > > > 	
> > > > I need to define the schema for "val"
> attribute in
> > > the below XML:
> > > > 
> > > > <data term="EXP">
> > > > <el val="20">
> > > > <ch> some data </ch>
> > > > </el>
> > > > <el val="21">
> > > > <ch> some data </ch>
> > > > </el>
> > > > .....similarly for val=22,23,24,....N </data>
> > > > 
> > > > <data term="SUPP">
> > > > <el val="20">
> > > > <ch> some data </ch>
> > > > </el>
> > > > <el val="21">
> > > > <ch> some data </ch>
> > > > </el>
> > > > .....similarly for val=22,23,24,....N </data>
> > > > 
> > > > Here, am more interested in the "val"
> attribute of
> > > "el" 
> > > > element. What is the Specific schema for "val"
> > > > attribute which satisfies the following
> > > conditions:
> > > > 1. allowed values for "val" are 20,21,22,.....
> N
> > > (no limit on
> > > > N although it's typically < 100.) 2. "val"
> always
> > > begins with
> > > > 20 in each "data" element scope.
> > > > 3. "val" must be in ascending order
> > > (20,21,22...etc) 4. "val" 
> > > > must be unique in each "data" element scope.
> > > > 


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


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


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.