topical media & game development
professional-xml-08-xslFromCode-.NET-SimpleXSLT-SimpleXSLT-sample.xsl / xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<contacts>
<xsl:apply-templates />
</contacts>
</xsl:template>
<xsl:template match="customer">
<cust>
<xsl:attribute name="id">
<xsl:value-of select="generate-id(contact/name)" />
</xsl:attribute>
<xsl:attribute name="company">
<xsl:value-of select="company" />
</xsl:attribute>
<xsl:apply-templates select="contact" />
</cust>
</xsl:template>
<xsl:template match="contact" name="contact">
<xsl:attribute name="name"><xsl:value-of select="name" /></xsl:attribute>
</xsl:template>
</xsl:stylesheet>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.