XML document
<? XML version = "1.0" encoding = "UTF-8"?>
<? XML-stylesheet type = "text/XSL" href = "tool. XSLT"?>
<Tool>
<Field ID = "prodname">
<Value> hammer hg2606 </value>
</Field>
<Field ID = "prodno">
<Value> 32456240 </value>
</Field>
<Field ID = "price">
<Value> $30.00 </value>
</Field>
</Tool>
XSLT document
Tool. XSLT
<? XML version = "1.0" encoding = "UTF-8"?>
<XSL: stylesheetversion = "1.0"
Xmlns: XSL = "http://www.w3.org/1999/XSL/Transform">
<XSL: template match = "/">
<HTML>
<Body>
<Form method = "Post" Action = "edittool. aspx">
<H2> tool information (edit): </H2>
<Table border = "0">
<XSL: For-each select = "tool/field">
<Tr>
<TD>
<XSL: value-of select = "@ ID"/>
</TD>
<TD>
<Input type = "text">
<XSL: attribute name = "ID">
<XSL: value-of select = "@ ID"/>
</XSL: attribute>
<XSL: attribute name = "name">
<XSL: value-of select = "@ ID"/>
</XSL: attribute>
<XSL: attribute name = "value">
<XSL: value-of select = "value"/>
</XSL: attribute>
</Input>
</TD>
</Tr>
</XSL: For-each>
</Table>
<Br/>
<Input type = "Submit" id = "btn_sub" name = "btn_sub" value = "Submit"/>
<Input type = "reset" id = "btn_res" name = "btn_res" value = "reset"/>
</Form>
</Body>
</Html>
</XSL: Template>
</XSL: stylesheet>
2. tool_updated.xslt
<? XML version = "1.0" encoding = "UTF-8"?>
<XSL: stylesheetversion = "1.0"
Xmlns: XSL = "http://www.w3.org/1999/XSL/Transform">
<XSL: template match = "/">
<HTML>
<Body>
<H2> updated tool information: </H2>
<Table border = "1">
<XSL: For-each select = "tool/field">
<Tr>
<TD>
<XSL: value-of select = "@ ID"/>
</TD>
<TD>
<XSL: value-of select = "value"/>
</TD>
</Tr>
</XSL: For-each>
</Table>
</Body>
</Html>
</XSL: Template>
</XSL: stylesheet>
Edittool. aspx
Protected void page_load (Object sender, eventargs E)
{
Xmldocument Doc = new xmldocument ();
Doc. Load (server. mappath ("~ /Tool. xml "));
String XSLT = server. mappath ("~ /Tool_updated.xslt ");
LoadFile (Doc, XSLT );
}
Public void LoadFile (xmldocument doc, string XSLT)
{
Extends compiledtransform transform = new extends compiledtransform ();
Transform. Load (XSLT );
Transform. Transform (Doc, null, context. response. output );
}