Altova Mailing List Archives


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

From: Nikolas.Nehmer@----------- (------- ------)
To:
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...
|
|Hi,
|
|I have a source XML file with following general structure:
|
|<root>
|	<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
|</root>
|
|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
XSL
|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="http://www.w3.org/1999/xhtml"
|xmlns:iese.config="http://www.iese.fhg.de/config"
|xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|exclude-result-prefixes="iese.config">
|	<xsl:output method="xml" encoding="UTF-8" indent="yes"
|doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
|doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
|	<xsl:template name="default-ul">
|		<xsl:variable name="unique-elements"
|select="*[generate-id()=generate-id(key('elementtags-by-name',name()))]
"
|/>
|		<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
|select="name()"/>
|						</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
|select="document(@href)/*/*[1]"/>
|			</a>
|		</li>
|	</xsl:template>
|	<xsl:template match="*" mode="composition_ul">
|			<li>
|				<xsl:value-of select="current()/*"/>
|			</li>
|	</xsl:template>
|</xsl:stylesheet>
|
|
|
| XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Disclaimer

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 www.altova.com/list/index.html. 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.