|
Subject: Re: [xsl] arbitrary depth element type conversion From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 03 Feb 2006 10:56:24 -0500 |
<xsl:template match="document">
<xsl:apply-templates/>
</xsl:template> <xsl:template match="*">
<div class="{name()}">
<xsl:apply-templates/>
</div>
</xsl:template><xsl:template match="text()"> <xsl:value-of select="."/> </xsl:template>
Cheers, Wendell
I have almost got there with this stylesheet:
<xsl:template match="document"> <xsl:apply-templates select="child::*" /> </xsl:template>
<xsl:template match="*"> <xsl:element name="div"> <xsl:attribute name="class"> <xsl:value-of select="name(.)" /> </xsl:attribute> <xsl:value-of select="." /> <xsl:apply-templates select="child::*" /> </xsl:element> </xsl:template>
but the element contents of child elements are being duplicated in parent elements:
<div class="first"> first first child of first second child of second <div class="first-child-of-first"> first child of first </div> <div class="second-child-of-second"> second child of second </div> </div> <div class="second"> second first child of second first grandchild of second <div class="first-child-of-second"> first child of second first grandchild of second <div class="first-grandchild-of-second"> first grandchild of second </div> </div> </div> <div class="third"> third </div>
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] arbitrary depth element t, David Carlisle | Thread | Re: [xsl] arbitrary depth element t, Sebastian Tennant |
| RE: Re: [xsl] Pagebreaks in Excel-H, cknell | Date | RE: [xsl] Pagebreaks in Excel-HTML , Mike Ferrando |
| Month |