Compound document (data & schema) help w/XSLT

  • Thread starter Scott Zabolotzky
  • Start date
S

Scott Zabolotzky

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"?>
<Model>
<Data>
<Component Name="A">
<Param Name="Param1">True</Param>
<Param Name="Param2">False</Param>
</Component>
<Component Name="B">
<Param Name="Param1">John Doe</Param>
<Group Name="Group1" Type="Common">
<Param Name="SubParam1">True</Param>
<Param Name="SubParam2">5</Param>
</Group>
</Component>
</Data>
<Schema>
<Component Name="A">
<Param Name="Param1" DataType="Bool" />
<Param Name="Param2" DataType="Bool" />
</Component>
<Component Name="B">
<Param Name="Param1" DataType="String" />
<Group Name="Common">
<Param Name="SubParam1" DataType="Bool" />
<Param Name="SubParam3" DataType="PosInt" Units="KB" />
</Group>
</Component>
<Component Name="C">
<Param Name="Param1" DataType="Bool" />
<Param Name="Param2" DataType="String" />
</Component>
</Schema>
</Model>
 
J

Joseph Kesselman

Scott said:

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top