Subject: RE:
From: "Harbarth, Juliane" <jhb@xxxxxxxxxxxxxx>
Date: Mon, 21 Jun 1999 13:08:37 +0200
|
From: Eugeny Kuzakov [mailto:kev@xxxxxxxxx]
> Example of xml:
> ...
> What I want in output?
> 1. On each <document> I need output list of documents that reference ( in
<ticker>)
> to this document.
> 2. On each <document> I need output list of <b>UNIQUE</b> names of
> documents to which this document reference.
>
After having completed your document with
<?xml version='1.0'?>
<documents>
...
</documents>
the follwing stylesheet converts it to a
HTML table containing each document including
the references from and towards it.
I used James Clark's XT. I would be grateful
for any advice on how to achieve this with a
shorter stylesheet (are four variables really
neccessary ?).
The stylesheet :
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
xmlns="http://www.w3.org/TR/REC-html40"
result-ns="">
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>Document References</TITLE>
</HEAD>
<BODY>
<CENTER>
<TABLE border="1">
<xsl:apply-templates/>
</TABLE>
</CENTER>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="document">
<TR valign="top">
<TD>
<xsl:value-of select="@name"/> / <xsl:value-of
select="@department"/>
</TD>
<TD>
<xsl:for-each select="ticker">
is referencing : <xsl:value-of select="@docrefto"/> /
<xsl:value-of select="@department"/>
<BR />
</xsl:for-each>
<BR />
<xsl:variable name="targetName"><xsl:value-of
select="@name"/></xsl:variable>
<xsl:variable name="targetDept"><xsl:value-of
select="@department"/></xsl:variable>
<xsl:for-each select="//document">
<xsl:variable name="sourceName"><xsl:value-of
select="@name"/></xsl:variable>
<xsl:variable name="sourceDept"><xsl:value-of
select="@department"/></xsl:variable>
<xsl:for-each select="ticker">
<xsl:if test="@docrefto=$targetName and
@department=$targetDept">
is referenced by : <xsl:value-of select="$sourceName"/> /
<xsl:value-of select="$sourceDept"/>
<BR />
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</TD>
</TR>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- RE:
- Harbarth, Juliane - Mon, 21 Jun 1999 13:08:37 +0200 <=
|
|