Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Processing Mixed Content (combining copy-of and apply-templates?) >Thread Next - Re: Processing Mixed Content (combining copy-of and apply-templates?) Re: Processing Mixed Content (combining copy-of and apply-templates?)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
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
