[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

AW: recursion with Muenchean Grouping...

Subject: AW: recursion with Muenchean Grouping...
From: Nikolas.Nehmer@xxxxxxxxxxx (Nikolas Nehmer)
Date: Wed, 18 Feb 2004 18:02:46 +0100
xsl unique elements
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:  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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.