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

Muenchean grouping as template...

Subject: Muenchean grouping as template...
From: Nikolas.Nehmer@xxxxxxxxxxx (Nikolas Nehmer)
Date: Mon, 16 Feb 2004 17:19:00 +0100
muenchen grouping
Hi,

I want to use some sort of Muenchean Grouping for a default visualizer
in my application. The default visualisation works fine. Now I want to
define this visualizer as a template to reuse it. How could I achieve
that? In general I would use a <template name="default"> structure and
call it from an including xsl with <call-template... But i need to pass
the nodeset on which the transform should be done to the default
visualizer, maybe with a param. But the key for my muenchen grouping
will be defined before the paramter is passed so the nodeset will not be
passed to the visualizer. To get a better imagination my default vis:

<?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:key name="elementtags-by-name" match="/*/*" use="name(.)"/>
	<xsl:variable name="home_directory"
select="document('../XML/config.xml')//iese.config:home_directory"/>
	<xsl:template match="/*">
		<xsl:variable name="unique-elements"
select="*[generate-id()=generate-id(key('elementtags-by-name',name(.)))]
"/>
		<html>
			<head>
				<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8"/>
				<link rel="stylesheet" type="text/css"
href="file://{$home_directory}/Application/CSS/stylesheet.css" />
				<title>Default Overview</title>		
			</head>
			<body>
				<h1>Default Overview</h1>
				<table>
					<tr>
						<xsl:apply-templates
select="$unique-elements" mode="header"/>
					</tr>
					<tr>
						<xsl:for-each
select="$unique-elements">
							<xsl:variable
name="elements-by-name" select="key('elementtags-by-name', name(.))"/>
							<td>

	
<xsl:choose>
	
<xsl:when test="@href">
	
<xsl:apply-templates select="$elements-by-name[name() = name(.)]"
mode="association_aggregation"/>
	
</xsl:when>
	
<xsl:when test="child::*">
	
<xsl:apply-templates select="$elements-by-name[name() = name(.)]"
mode="composition"/>
	
</xsl:when>
	
<xsl:otherwise>
	
<xsl:apply-templates select="$elements-by-name[name() = name(.)]"
mode="attribute"/>
	
</xsl:otherwise>
	
</xsl:choose>
							</td>
						</xsl:for-each>
					</tr>
				</table>
			</body>
		</html>
	</xsl:template>
	
	<xsl:template match="*" mode="header">
		<th>
			<xsl:choose>
				<xsl:when test="contains(name(.),':')">
					<xsl:value-of
select="substring-after(name(.),':')"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="name(.)"/>
				</xsl:otherwise>
			</xsl:choose>
		</th>
	</xsl:template>
	
	<xsl:template match="*" mode="attribute">
		<p>	
			<xsl:value-of select="current()"/>
		</p>
	</xsl:template>
	
	<xsl:template match="*" mode="association_aggregation">
		<p>
			<a href="{@href}">
				<xsl:value-of
select="document(@href)/*/*[1]"/>
			</a>
		</p>
	</xsl:template>
	
	<xsl:template match="*" mode="composition">
		<p>
			<xsl:value-of select="current()/*[1]"/>
		</p>
	</xsl:template>

</xsl:stylesheet>


Best regards,
Nick


 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.