[XML Schema] Attributes

Discussion in 'XML' started by kelvSYC, Aug 11, 2005.

  1. kelvSYC

    kelvSYC Guest

    Is it possible to make an attribute required, optional, or forbidden
    depending on the value of another attribute? How about changing
    element content based on an attribute?

    --
    I am only a mirage.
     
    kelvSYC, Aug 11, 2005
    #1
    1. Advertising

  2. On Thu, 11 Aug 2005 04:33:03 GMT, kelvSYC <> wrote:

    >Is it possible to make an attribute required, optional, or forbidden
    >depending on the value of another attribute? How about changing
    >element content based on an attribute?


    Sure - just not with W3C XML Schema <g>. You can supplement XML Schema with
    Schematron or just write a custom XSL transform that produces output
    describing any rules if finds to be broken.
     
    Steve Jorgensen, Aug 11, 2005
    #2
    1. Advertising

  3. kelvSYC

    kelvSYC Guest

    In article <>, Steve
    Jorgensen <> wrote:

    > On Thu, 11 Aug 2005 04:33:03 GMT, kelvSYC <> wrote:
    >
    > >Is it possible to make an attribute required, optional, or forbidden
    > >depending on the value of another attribute? How about changing
    > >element content based on an attribute?

    >
    > Sure - just not with W3C XML Schema <g>. You can supplement XML Schema with
    > Schematron or just write a custom XSL transform that produces output
    > describing any rules if finds to be broken.


    What about other schema languages? Does RELAX NG, for example, have
    this ability?

    --
    I am only a mirage.
     
    kelvSYC, Aug 11, 2005
    #3
  4. On Thu, 11 Aug 2005 06:35:59 GMT, kelvSYC <> wrote:

    >In article <>, Steve
    >Jorgensen <> wrote:
    >
    >> On Thu, 11 Aug 2005 04:33:03 GMT, kelvSYC <> wrote:
    >>
    >> >Is it possible to make an attribute required, optional, or forbidden
    >> >depending on the value of another attribute? How about changing
    >> >element content based on an attribute?

    >>
    >> Sure - just not with W3C XML Schema <g>. You can supplement XML Schema with
    >> Schematron or just write a custom XSL transform that produces output
    >> describing any rules it finds to be broken.

    >
    >What about other schema languages? Does RELAX NG, for example, have
    >this ability?


    I'm not a RELAX NG user because it isn't supported for what I need, but I am
    led to understand that it cannot do things like that, and that Scehamtron is
    pretty much the only schema language that can.

    You can embed Schematron in either XML Schema or in RELAX NG, and most decent
    XML editors can use the embedded Schematron if you tell them to (I use
    <oXygen/> for this).

    I'm starting to see, though, that even though it's a separate file and a bit
    harder to keep clean and legible, using a custom xsl file might be the better
    way to go. For one thing, you can use XSLT 2.0 without worrying about whether
    your editor supports XSLT 2.0 functionality in Schematron, and for another
    thing, you don't have to figure out how you're going to use Schematron to
    validate documents in an application using, say, MSXML.
     
    Steve Jorgensen, Aug 11, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,552
    Markus
    Nov 23, 2005
  2. Fred Smith
    Replies:
    1
    Views:
    949
    Martin Honnen
    Feb 5, 2004
  3. Hari Om
    Replies:
    1
    Views:
    463
    Martin SChukrazy
    Mar 2, 2004
  4. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,269
    Stanimir Stamenkov
    Apr 25, 2005
  5. Replies:
    3
    Views:
    2,875
Loading...

Share This Page