Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Processing Mixed Content (combining copy-of and apply-templates?)

From: "KW" <kevinw@------.--.--->
To: NULL
Date: 1/5/2007 8:05:00 AM

Thanks Dimitre. I appreciate your help.

To continue on this topic, do you think this is a good approach (mixing
the html and xml custom tags) to allow someone to define how to lay
something out.

I am working on a project where I need to allow non-technical people,
who can work with some basic XML tags, to define an online form for our
application. Because there are several complex issues relating to
rendering the actual html form code, such as tying the fields to actual
data fields in our db and validation code, I wanted to provide a
simplified "form definition language" that was tailored to our specific
application.

Most of the time, this works fine. For example, a user can define the
following...

<page>
  <section>
    <title>Address Information</title>
    <field name="Street1" type="text" required="true"'
           label="Street Address" max-length="25" />
    <field name="City" type="text" required="true"
           label="City" max-length="50" />
    <field name="State" type="dropdown" required="true"
           label="State" max-length="25">
        <list lookup="StateList" />
    </field>
    <field name="ZipCode" type="text" required="true"
           label="Zip Code" max-length="15" />
  </section>
</page>

And an xsl stylesheet would transform this into a nice form layout with
all the complex issues handled.

But, sometimes, the users want more control over the layout of the
form. For example, they sometimes will want to have two fields on one
line (rather than a single field on a single line), or perhaps to
position labels on top of the data entry box instead of to the left. I
am experimenting with allowing some control declaratively through the
xml, like this...

<field .... label-pos="top" ... />

or

<row>
  <cell>
    <field .... />
  </cell>
  <cell>
    <field ... />
  </cell>
</row>

But, now, I have introduced layout and formatting issues into the xml
that was intended to define the form. Plus, now I have to create
templates to transform these additional concepts into html.

So, that is when I started wondering about allowing the use of XHTML
mixed with the XML tags that define the form elements, as the previous
post alludes to.

I appreciate opinions from anyone on this challenge. Thanks!

Kevin


Dimitre Novatchev wrote:
> "KW" <kevinw@a...> wrote in message
> news:1167949889.753016.30180@q......
> > If I have an xml snippet like...
> >
> > <mytag>
> >  <h1>A Title Here</h1>
> >  <p>A paragraph here</p>
> >  <myothertag someatt="something">
> >    <more tags />
> >  </myothertag>
> >  <p>A final paragraph</p>
> > </mytag>
> >
> > which contains both XHTML and some custom XML tags, how can I have my
> > XSL stylesheet process the XHTML tags using a <copy-of> approach
> > (simply outputting the markup as is) and also process the custom XML
> > tags using a <apply-templates> approach, all while maintaining the
> > order of the items in the result tree?
> >
> > I know I could write templates for every possible HTML tag along with
> > templates for my custom XML tags, but that seems like more work than
> > necessary. The idea is that I want to be able to combine XHTML and
> > custom tags within a specific element, but only really override the
> > processing for the custom XML tags.
> >
> > Is this even possible?
>
> Yes, and it is very easy :o)
>
> Do read about "identity template" or "identity transformation".
> 
> Cheers,
> Dimitre Novatchev



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent