Fri, 24 Mar 2006 10:55:29 -0500, in comp.text.xml,
Joseph Kesselman wrote :
Impossible to answer without seeing what you're setting LANGS to and
what your input document is.
Ok, the file.xsl is :
================================================== ====================
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:variable name="LANGS"
select="//span[not(@xml:lang=preceding::span/
@xml:lang)]/@xml:lang"/>
<xsl:template match="@*|node()">
<xsl:for-each select="$LANGS">
<xsl:value-of select="$filename"/>.<xsl:value-of
select='document("menu.xml")/menu/item[@name=$filename]/
ch[titre=$chapitre]/titre[@lang=$LANGS]'/>.<xsl:value-of
select="."/>
.html
</xsl:for-each>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
================================================== ====================
I apply it to file.xml:
================================================== ====================
<?xml version="1.0" encoding="ISO-8859-1"?>
<body>
<h1>
<span xml:lang="en">Level two. </span>
<span xml:lang="fr">Secondes. </span>
Chapitre : Statistiques</h1>
<h3>1.
Activités : </h3>
<table class="classe" border="1" cellspacing="4"/>
<h3>2.
Cours : </h3>
<table class="classe" border="1" cellspacing="4"/>
<h3>3.
Exercices : </h3>
<table class="classe" border="1" cellspacing="4"/>
<h3>4.
Travaux dirigés : </h3>
<table class="classe" border="1" cellspacing="4"/>
<h3>5.
Baccalauréat : </h3>
<table class="classe" border="1" cellspacing="4"/>
<h3>6.
Figures dynamiques : </h3>
<table class="classe" border="1" cellspacing="4"/>
<h3>7.
Contrôles : </h3>
<table class="classe" border="1" cellspacing="4"/>
<h3>8.
Notes : </h3>
<table class="classe" border="1" cellspacing="4"/>
</body>
================================================== ====================
with the command :
xsltproc -stringparam filename secondes -stringparam chapitre
Statistics file.xsl file.xml
And menu.xml contains :
================================================== ====================
<?xml version="1.0" encoding="ISO-8859-1"?>
<menu>
<item name='index'>
<text lang='en'>Home</text>
<text lang='fr'>Accueil</text>
</item>
<item name='secondes'>
<text lang='en'>Level two</text>
<text lang='fr'>Secondes</text>
<ch>
<titre lang='en'>Numbers and calculators</titre>
<titre lang='fr'>Nombres et calculatrices</titre>
</ch>
<ch>
<titre lang='en'>Functions and problems of first degree</titre>
<titre lang='fr'>Fonctions et problemes du premier degre</titre>
</ch>
<ch>
<titre lang='en'>Circular functions</titre>
<titre lang='fr'>Trigonometrie et fonctions circulaires</titre>
</ch>
<ch>
<titre lang='en'>Statistics</titre>
<titre lang='fr'>Statistiques</titre>
</ch>
<ch>
<titre lang='en'>Visual and computation in 3D</titre>
<titre lang='fr'>Voir et calculer dans l'espace</titre>
</ch>
</menu>
================================================== ====================
the result is :
secondes.Statistics.en.html
secondes.Statistics.fr.html
but I want
secondes.Statistics.en.html
secondes.Statistiques.fr.html
^^^^
Regards
--
ph