XML equivalent to an #ifdef?

Discussion in 'XML' started by a5ehren@gmail.com, Jan 13, 2006.

  1. Guest

    For my job, we need to be able to dynamically compile a document based
    on flags we send to the compiler; for example, the non-US version of
    our program has features removed that foreign users are not allowed to
    know about, so we need to remove any mention of them from the user's
    manual. We're trying to save a lot of time by not having to maintain
    two versions of the manual - is there any XML markup that will allow a
    parser to selectively remove parts of the document?
    , Jan 13, 2006
    #1
    1. Advertising

  2. * wrote in comp.text.xml:
    >For my job, we need to be able to dynamically compile a document based
    >on flags we send to the compiler; for example, the non-US version of
    >our program has features removed that foreign users are not allowed to
    >know about, so we need to remove any mention of them from the user's
    >manual. We're trying to save a lot of time by not having to maintain
    >two versions of the manual - is there any XML markup that will allow a
    >parser to selectively remove parts of the document?


    The format you use to make the manual might have such means, other than
    that you'll have to build that yourself, e.g. a processing instruction
    could be added to signal this, like <?ifdef ...?>...<?endif?>.
    --
    Björn Höhrmann · mailto: · http://bjoern.hoehrmann.de
    Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
    68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
    Bjoern Hoehrmann, Jan 13, 2006
    #2
    1. Advertising

  3. Andy Dingley Guest

    On 13 Jan 2006 08:41:28 -0800, wrote:

    >- is there any XML markup that will allow a
    >parser to selectively remove parts of the document?


    No, but this isn't a task that's appropriate for the _parser_ to be
    doing anyway. XML parsers turn serialised documents into in-memory
    DOMs, they don't make processing choices about things.

    Such a task would be trivial to process in XSLT. Define some flag or
    other in whatever schema you use to represent your documents (DocBook ?)
    and process on its value.
    Andy Dingley, Jan 13, 2006
    #3
  4. In article <>,
    Andy Dingley <> wrote:

    >>- is there any XML markup that will allow a
    >>parser to selectively remove parts of the document?


    >No, but this isn't a task that's appropriate for the _parser_ to be
    >doing anyway. XML parsers turn serialised documents into in-memory
    >DOMs, they don't make processing choices about things.


    That's not *quite* true. Conditional sections in the DTD allow you
    some control, but not necessarily a convenient way to switch things
    without changing a file.

    >Such a task would be trivial to process in XSLT.


    Yes, and XSLT processors let you pass in parameters on the command
    line.

    -- Richard
    Richard Tobin, Jan 14, 2006
    #4
  5. Peter Flynn Guest

    wrote:
    > For my job, we need to be able to dynamically compile a document based
    > on flags we send to the compiler; for example, the non-US version of
    > our program has features removed that foreign users are not allowed to
    > know about, so we need to remove any mention of them from the user's
    > manual. We're trying to save a lot of time by not having to maintain
    > two versions of the manual - is there any XML markup that will allow a
    > parser to selectively remove parts of the document?


    Not quite, but the Entity Switch mechanism is heavily used in many
    industrial DTDs to control which content models become allowed for
    different classes of document. DocBook has this kind of modularity
    enabled. What you describe are known as "effectivities", which are
    classifications of certain element types (using sttribute values; see
    DocBook again for an example) that your processor can recognise so
    that only the appropriate parts of the document are output. This does
    indeed allow you to maintain a single master document and output
    targeted versions.

    ///Peter
    Peter Flynn, Jan 15, 2006
    #5
    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. Replies:
    0
    Views:
    610
  2. Replies:
    1
    Views:
    728
    Kevin Spencer
    May 31, 2005
  3. F. Edward Boas

    typedef and #ifdef

    F. Edward Boas, Aug 11, 2003, in forum: C++
    Replies:
    1
    Views:
    962
    Alf P. Steinbach
    Aug 11, 2003
  4. Christopher M. Lusardi
    Replies:
    1
    Views:
    4,082
  5. Christopher M. Lusardi
    Replies:
    1
    Views:
    418
    Victor Bazarov
    Nov 19, 2004
Loading...

Share This Page