[XML Schema] Attributes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kelvSYC

    [XML Schema] Attributes

    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.
  • Steve Jorgensen

    #2
    Re: [XML Schema] Attributes

    On Thu, 11 Aug 2005 04:33:03 GMT, kelvSYC <kelvSYC@no.ema il.shaw.ca> wrote:
    [color=blue]
    >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?[/color]

    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.

    Comment

    • kelvSYC

      #3
      Re: [XML Schema] Attributes

      In article <g9plf1dn69jjng 8joo7an8rognmfg eonc3@4ax.com>, Steve
      Jorgensen <nospam@nospam. nospam> wrote:
      [color=blue]
      > On Thu, 11 Aug 2005 04:33:03 GMT, kelvSYC <kelvSYC@no.ema il.shaw.ca> wrote:
      >[color=green]
      > >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?[/color]
      >
      > 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.[/color]

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

      --
      I am only a mirage.

      Comment

      • Steve Jorgensen

        #4
        Re: [XML Schema] Attributes

        On Thu, 11 Aug 2005 06:35:59 GMT, kelvSYC <kelvSYC@no.ema il.shaw.ca> wrote:
        [color=blue]
        >In article <g9plf1dn69jjng 8joo7an8rognmfg eonc3@4ax.com>, Steve
        >Jorgensen <nospam@nospam. nospam> wrote:
        >[color=green]
        >> On Thu, 11 Aug 2005 04:33:03 GMT, kelvSYC <kelvSYC@no.ema il.shaw.ca> wrote:
        >>[color=darkred]
        >> >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?[/color]
        >>
        >> 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.[/color]
        >
        >What about other schema languages? Does RELAX NG, for example, have
        >this ability?[/color]

        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.

        Comment

        Working...