-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I have to XSL's which work together. The first (sitzplan_pre.xsl) uses a
javascript extension, the second (sitzplan.xsl) is a "normal" XSL. Seperatly,
the two files work fine. Used together, e.g. in a cocoon pipeline, the
template sitzplan:Tisch in the second XSL doesn't get any attributes. I've
attached all interesting files. I've deleted some parts of the files, to make
them smaller. Hope the mail is not to long.
With kind regards
Torsten Knodt
P.S.: Is there a "nice" way to put this in one XSL?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE76BqLvxZktkzSmiwRAq2UAJ9F9CMnnV1q5S1BJDQscuiNoTg9agCfe4MG
qmWLpyBJIXab0GOtHpjMCvI=
=s8rw
-----END PGP SIGNATURE-----
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<sitzplan:sitzplan
title="Bürgerhaus Bornheim"
xmlns:sitzplan="http://127.0.0.1:8080/dtd/sitzplan"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="sitzplan"
>
<sitzplan:TischReihe x="0" y="0" tische="10" nummer="1" platz="90" />
</sitzplan:sitzplan>
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sitzplan="http://127.0.0.1:8080/dtd/sitzplan"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:ext="ext"
extension-element-prefixes="ext"
exclude-result-prefixes="xsl sitzplan lxslt ext"
>
<xsl:output indent="yes" type="xml"/>
<lxslt:component prefix="ext" elements="times" functions="counter" >
<lxslt:script lang="javascript">
var c = 0;
function counter()
{
return c;
}
function times(xslProcessorContext, elem)
{
var oTransformer = xslProcessorContext.getTransformer();
var cNode = xslProcessorContext.getContextNode();
var start = elem.getAttribute("start", cNode, oTransformer);
var last = elem.getAttribute("last", cNode, oTransformer);
for (c = start; c <= last; c++)
oTransformer.executeChildTemplates (elem, true);
return null;
}
</lxslt:script>
</lxslt:component>
<xsl:template match="sitzplan:TischReihe">
<g transform="{concat('translate(',@x,',',@y,')')}">
<desc>Tischreihe Nummer <xsl:value-of select="@nummer"/> mit <xsl:value-of select="@tische"/> Tischen</desc>
<ext:times start="1" last="[EMAIL PROTECTED]">
<xsl:element name="sitzplan:Tisch">
<xsl:attribute name="x"><xsl:value-of select="ext:counter()*6"/></xsl:attribute>
<xsl:attribute name="y">0</xsl:attribute>
<xsl:attribute name="nummer"><xsl:value-of select="@nummer"/></xsl:attribute>
<xsl:attribute name="platz">1</xsl:attribute>
</xsl:element>
</ext:times>
</g>
</xsl:template>
<xsl:template match="@*|node()|text()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()|text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN" "http://www.w3.org/TR/2000/03/WD-SVG-20000303/">
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 297 210" height="21cm" width="297mm">
<g transform="translate(0,0)">
<desc>Tischreihe Nummer 1 mit 10 Tischen</desc>
<!-- Next line you can see an example for the problem (the values for translate are missing) -->
<g transform="translate(,)">
<desc>Tisch Nummer mit Platz </desc>
<!-- Deleted some lines -->
</g>
</g>
</svg>
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sitzplan="http://127.0.0.1:8080/dtd/sitzplan"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="xsl sitzplan"
>
<xsl:output indent="yes" type="xml"/>
<xsl:template match="sitzplan:sitzplan">
<svg
width="297mm"
height="21cm"
viewBox="0 0 297 210"
>
<defs>
<defs>
<symbol id="Tisch" viewBox="0 0 6 3">
<rect id="Tisch" x="0" y="0" width="6" height="3" fill="none" stroke="black" />
</symbol>
<symbol id="Stuhl" viewBox="0 0 2 3">
<rect id="Stuhl" x="0" y="0" width="2" height="3" fill="none" stroke="black" />
</symbol>
</defs>
<symbol id="TischMitStuehlen" viewBox="0 0 6 9">
<use x="0" y="3" width="6" height="3" xlink:href="#Tisch" />
</symbol>
</defs>
<xsl:apply-templates />
</svg>
</xsl:template>
<xsl:template match="sitzplan:Tisch">
<g transform="{concat('translate(',@x,',',@y,')')}">
<desc>Tisch Nummer <xsl:value-of select="@nummer" /> mit Platz <xsl:value-of select="@platz" /></desc>
<use x="0" y="0" width="6" height="9" xlink:href="#TischMitStuehlen" />
</g>
</xsl:template>
<xsl:template match="@*|node()|text()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()|text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>