Compound document (data & schema) help w/XSLT

Discussion in 'XML' started by Scott Zabolotzky, Sep 5, 2006.

  1. I've got an XML file that contains both a data section and a
    custom schema section. The data may represent only a subset of
    the parameters defined by the schema.

    I'm new to XSLT and I'm trying to figure out how to generate a
    tranform that will create an HTML form from the schema section
    and populate the controls with the values from the data section
    (if present).

    I _think_ I'd be able to come up with the transform to generate
    the form based on the schema (remember, I'm new to this) but the
    conditional "if value present in data section, populate control
    with value" is something I that I don't even know how to begin to
    implement. If you're walking down the schema nodes how do you
    refer back to nodes that may be present in the data and extract
    their values?

    Any advice would be greatly appreciated.

    <?xml version="1.0" encoding="UTF-8"?>
    <Component Name="A">
    <Param Name="Param1">True</Param>
    <Param Name="Param2">False</Param>
    <Component Name="B">
    <Param Name="Param1">John Doe</Param>
    <Group Name="Group1" Type="Common">
    <Param Name="SubParam1">True</Param>
    <Param Name="SubParam2">5</Param>
    <Component Name="A">
    <Param Name="Param1" DataType="Bool" />
    <Param Name="Param2" DataType="Bool" />
    <Component Name="B">
    <Param Name="Param1" DataType="String" />
    <Group Name="Common">
    <Param Name="SubParam1" DataType="Bool" />
    <Param Name="SubParam3" DataType="PosInt" Units="KB" />
    <Component Name="C">
    <Param Name="Param1" DataType="Bool" />
    <Param Name="Param2" DataType="String" />
    Scott Zabolotzky, Sep 5, 2006
    1. Advertisements

  2. Anyone??
    Scott Zabolotzky, Sep 7, 2006
    1. Advertisements

  3. Scott Zabolotzky wrote:
    > Anyone??

    I think you're getting silence because you've got a combination of
    issues that normally don't get conflated. Generating user interfaces
    from schemas is uncommon; I haven't yet seen a really good system or
    stylesheet for that purpose (despite having been involved in some early
    experimentation along those lines). Folding schemas into the instance
    document is likewise uncommon and tends to defeat the
    standardization-of-document-format goals that schemas are most often
    used for.

    Basically, half-solution you present is one I wouldn't particularly want
    to tackle.

    You might want to consider taking a step back and stating what problem
    you're actually trying to solve, rather than how you're trying to solve
    it, and see what folks suggest.

    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
    Joseph Kesselman, Sep 7, 2006
    1. Advertisements

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.

Share This Page