Altova Mailing List Archives

AW: [xsl] recursion with Muenchean Grouping...

From: Nikolas.Nehmer@----------- (------- ------)
Date: 2/18/2004 7:06:00 AM
Would it be possible to create a href which points to a part, in
particular, to the nested root element and display it with the same
transformation? So only display the elements on the first level and to
have hrefs to the deeper lying elements? 

|-----Ursprüngliche Nachricht-----
|Von: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-
|list@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von Nikolas Nehmer
|Gesendet: Mittwoch, 18. Februar 2004 16:13
|An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
|Betreff: [xsl] recursion with Muenchean Grouping...
|I have a source XML file with following general structure:
|	<element>text</element> 	occurence 0 to unbounded
|	<element href="URL"/>		occurence 0 to unbounded
|	<element>***</element>		*** means a structure like root;
|occurence 0 to unbounded
|I'm trying to develope a generic html visualization for such a XML
|document. As you can see by the *** recursion is involved. But I don't
|know how to handle it exactly? I think I need another key which groups
|the *** root elements? Does anyone have a solution? At the Moment my
|looks like that:
|Key defined in other XSL:
|<xsl:key name="elementtags-by-name" match="*" use="name(.)"/>
|<?xml version="1.0" encoding="UTF-8"?>
|<xsl:stylesheet version="1.0" xmlns=""
|	<xsl:output method="xml" encoding="UTF-8" indent="yes"
|doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
|	<xsl:template name="default-ul">
|		<xsl:variable name="unique-elements"
|		<ul>
|			<xsl:for-each select="$unique-elements">
|				<xsl:variable name="elements-by-name"
|select="key('elementtags-by-name', name())"/>
|				<xsl:choose>
|					<xsl:when test="@href">
|						<xsl:apply-templates
|select="$elements-by-name" mode="association_aggregation_ul"/>
|					</xsl:when>
|					<xsl:when test="child::*">
|						<li>
|							<xsl:value-of
|						</li>
|						<ul>
|<xsl:apply-templates select="current()/*" mode="composition_ul"/>
|						</ul>
|					</xsl:when>
|					<xsl:otherwise>
|						<xsl:apply-templates
|select="$elements-by-name" mode="attribute_ul"/>
|					</xsl:otherwise>
|				</xsl:choose>
|			</xsl:for-each>
|		</ul>
|	</xsl:template>
|	<xsl:template match="*" mode="attribute_ul">
|		<li>
|			<xsl:value-of select="current()"/>
|		</li>
|	</xsl:template>
|	<xsl:template match="*" mode="association_aggregation_ul">
|		<li>
|			<a href="{@href}">
|				<xsl:value-of
|			</a>
|		</li>
|	</xsl:template>
|	<xsl:template match="*" mode="composition_ul">
|			<li>
|				<xsl:value-of select="current()/*"/>
|			</li>
|	</xsl:template>
| XSL-List info and archive:

 XSL-List info and archive:


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.