[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: generic template - possible?

Subject: RE: generic template - possible?
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 16 Apr 2002 11:03:11 +0300
generic template
Heppa,

> I am somewhat new to XSL.  I am trying to write a template that will
> convert xhtml forms to wml forms. 
> I want to write a generic conversion that will convert:
> 
> <FORM method=GET action="http://www.google.com/search">
> <INPUT TYPE=text name=q size=12 maxlength=255 value=""> 
> <INPUT type=submit name=btnG VALUE=" Google ">
> </FORM>

This is not XHTML...

> Is this possible to do with one template??  I just don't seem to know
> how to approach this.  Can anybody help?

<?xml version="1.0" encoding="ISO-8859-1"?> 
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xhtml="http://www.w3.org/1999/xhtml"
                exclude-result-prefixes="xhtml">

<xsl:template match="xhtml:form">
  <xsl:apply-templates select="xhtml:input" />
</xsl:template>

<xsl:template match="xhtml:input">
  <input>
    <xsl:copy-of select="@name | @size | @maxlength" />
  </input>
</xsl:template>

<xsl:template match="xhtml:input[@type = 'submit']">
  <do type="accept" label="{normalize-space(@value)}" /> 
</xsl:template>

</xsl:stylesheet>

or something like this *IF* your input is XHTML.

Cheers,

Santtu

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.