RE: [xsl] Using attribute values in html conversion

Subject: RE: [xsl] Using attribute values in html conversion
From: John Pallister <jpallister@xxxxxxxxxxxx>
Date: Tue, 1 Oct 2002 15:05:07 -0400
Try using an attribute value template:

<input type="text" name={@name} maxlength={@maxLength}/>

John Pallister

-----Original Message-----
From: Zietak, James [mailto:James.Zietak@xxxxxxxxxxxxxxx]
Sent: Tuesday, October 01, 2002 2:48 PM
To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
Subject: [xsl] Using attribute values in html conversion

Hello All,

I'm trying to convert an XML document to HTML using XSLT. The problem is I
want to use the value of an attribute as a value for an attribute of an html
node. Here is an example.

<?xml version="1.0"?>
<schema xmlns="";>
    <element name="Person">
                <element name="surname" type="string" maxLength="10"/>
                <element name="firstname" type="string" maxLength="10"/>
                <element name="middlename" type="string" maxLength="10"/>
                <element name="gender" type="string"/>
                <element name="dob" type="string" maxLength="10"/>

I would like to take an element:
	<element name="surname" type="string" maxLength="10"/>

and generate an html input field using the values of the attributes name,
and maxLength ie:
	<input type="text" name=$SURNAME  maxlength=$MAXLENGTH/>

The first idea that came to mind would be something of the sort:
	<input type="text" name=<xsl:apply-templates select="@name"/>
maxlength=<xsl:templates select="@maxLength"/> >

Obviously this is incorrect. I assume this is due to the fact that the
output must be well-formed html. Is there any way to work around this?


 XSL-List info and archive:

 XSL-List info and archive:

Current Thread