cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan" <>
Subject Produce an independent xml archive from another xml
Date Wed, 03 Jan 2001 12:28:18 GMT
Hi all again!
Is there anyway to produce an XML archive from
another XML within an XSL. The example I wrote:

XML File (proverbs.xml)

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="proverbs.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
Poverty is the mother of all arts. 
If you scratch my back, I'll scratch yours. 
There's many a good tune played on an old fiddle. 
Of evil grain, no good seed can come. 
That's the thanks you get. 
Words hurt more than swords. 
Once in a while never hurt anyone. 
Many a true word is spoken in jest. 
God tempers the wind to the shorn lamb.
Where there's a sweet, there's always a bitter. 
In many words, a lie or two may escape. 
A man's house is his castle.

XSL File (proverbs.xsl)

<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:stylesheet xmlns:xsl="" xmlns:java=""
exclude-result-prefixes="java" version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="proverbs">
<xsl:processing-instruction name="cocoon-format">type="text/html"</xsl:processing-instruction>

<title>Random Proverbs</title>
<xsl:variable name="pro" select="count(pro)" /> 
There are <b><xsl:value-of select="$pro" /></b> proverbs in the list. 
<br /> 
<br />
<xsl:for-each select="pro">
<xsl:apply-templates select="." /> 
<br /> 
<br /> 
<xsl:variable name="Rand" select="" />
<xsl:variable name="result" select="ceiling(count(pro) * java:nextDouble($Rand))" />

<center><big><b>Selected Proverb</b></big></center>
<xsl:when test="$result = 0">
<center><b><xsl:value-of select="pro[1]" /></b></center>
<center><b><xsl:value-of select="pro[$result]" /></b></center>

Concerning this examples, is anyway to get outputed to another independent
XML file the result of the random selection, instead of getting the result in the
same xml file?¿ I mean producing an independent proverb1.xml file, i.e.
Could anyone point me in the right way to achieve it?¿


Iván Fontán
Technical Department


Spain Office
Trav. Gràcia, 342-344
08025 Barcelona (Spain)
Tel.: +34 934 465 026

US Offices
New York
885 3rd Avenue
Suite 2800
New York, NY 10022

1210 Brickell Avenue
Suite 430
Miami, FL 33131

View raw message