[Home] [By Thread] [By Date] [Recent Entries]
Hi,
Mike's elegant 2.0 recursive variable processing can also be extended easily to support a more granular mapping of attribute/value combinations to elements, something like this: <xsl:template match="p[@*]">
<xsl:variable name="temp">
<p>
<xsl:copy-of select="remove(@*, 1)"/>
<xsl:apply-templates select="@*[1]" mode="map-attribute"/>
</p>
</xsl:variable>
<xsl:apply-templates select="$temp"/>
</xsl:template><xsl:template match="p[not(@*)]"> <xsl:sequence select="."/> </xsl:template> <xsl:template match="@*" mode="map-attribute">
<xsl:element name="{name(.)}">
<xsl:copy-of select="../node()"/>
</xsl:element>
</xsl:template><xsl:template match="@style[.='bold']" mode="map-attribute">
<b>
<xsl:copy-of select="../node()"/>
</b>
</xsl:template>Here's an old XSLT 1.0 precursor: http://markmail.org/message/nxrz4kk42lr4jxo2
On 12/21/2010 7:47 AM, Michael Kay wrote: On 21/12/2010 12:30, Matthieu Ricaud-Dussarget wrote:Hi all,It's not actually a grouping problem as commonly understood. -- ====================================================================== 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 ======================================================================
|

Cart



