This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: new user xslt
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Mon, 29 Apr 2002 16:45:24 +0100
- Subject: RE: [xsl] new user xslt
- Reply-to: xsl-list at lists dot mulberrytech dot com
I corrected your stylesheet to change "xsl:space" to "xml:space" in two
places (Saxon reported this error, Stylus should have done so too).
I changed xml:stylesheet to xml-stylesheet in the source document (again,
Saxon reported this error).
Saxon then ran the stylesheet with four warnings:
Warning: at xsl:element on line 87 of file:/c:/temp/test.xsl:
Invalid element name:
Partie modifiée
Warning: at xsl:element on line 87 of file:/c:/temp/test.xsl:
Invalid element name:
Identification des
règles
Warning: at xsl:element on line 87 of file:/c:/temp/test.xsl:
Invalid element name:
B006
Warning: at xsl:element on line 87 of file:/c:/temp/test.xsl:
Invalid element name:
Paramètre P008
(These are "recoverable errors" according to the XSLT specification. By
default, Saxon reports the error and continues processing).
I added <xsl:strip-space elements="*"/> and changed line 87 to:
<xsl:element name="{translate(normalize-space(cell[1]), ' ', '_') }">
and the output is now:
<?xml version="1.0" encoding="iso-8859-1"?>
<document>
<titre1>
<ht>Introduction :</ht>
</titre1>
<titre1>
<ht>Historiques des évolutions :</ht>
<titre2>
<ht>A- Evolutions de la V5.3 :</ht>
<tableau>
<Partie_modifiée>Evolution</Partie_modifiée>
<Identification_des_règles>Modification de forme : COD07 devient
COD07RA</Identification_des_règles>
<B006>Renvoi vers le tableau paramètre de l'assimilation</B006>
<Paramètre_P008>Assimilation de la formation</Paramètre_P008>
</tableau>
</titre2>
</titre1>
</document>
Whether this is what you actually want, is something I leave to you. Note
that it will still fail if your cell[1] contains characters that aren't
allowed in an XML name, for example "/".
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of
> CHAOUI Hassan
> Sent: 29 April 2002 11:00
> To: 'xsl-list@lists.mulberrytech.com'
> Subject: RE: [xsl] new user xslt
>
>
> This the xsl file :
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="xml" omit-xml-declaration="no" indent="yes"
> encoding="iso-8859-1"/>
> <xsl:template match="mydoc">
> <document>
> <xsl:apply-templates/>
> </document>
> </xsl:template>
>
> <xsl:template match="h1">
> <titre1>
> <xsl:apply-templates/>
> </titre1>
> </xsl:template>
>
> <xsl:template match="h2">
> <titre2>
> <xsl:apply-templates/>
> </titre2>
> </xsl:template>
>
> <xsl:template match="h3">
> <titre3>
> <xsl:apply-templates/>
> </titre3>
> </xsl:template>
>
> <xsl:template match="h4">
> <titre4>
> <xsl:apply-templates/>
> </titre4>
> </xsl:template>
>
> <xsl:template match="h5">
> <titre5>
> <xsl:apply-templates/>
> </titre5>
> </xsl:template>
>
> <xsl:template match="h6">
> <titre6>
> <xsl:apply-templates/>
> </titre6>
> </xsl:template>
>
> <xsl:template match="ht">
> <ht>
> <xsl:apply-templates/>
> </ht>
> </xsl:template>
>
> <xsl:template match="p">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="list[@style = "bullet"]">
> <bullet>
> <xsl:apply-templates/>
> </bullet>
> </xsl:template>
>
> <xsl:template match="list[@style = "numeric"]">
> <listeNumerique>
> <xsl:apply-templates/>
> </listeNumerique>
> </xsl:template>
>
> <xsl:template match="item">
> <liste>
> <xsl:apply-templates/>
> </liste>
> </xsl:template>
>
> <xsl:template match="ex">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="table" xsl:space="preserve">
> <tableau>
> <xsl:apply-templates/>
> </tableau>
> </xsl:template>
>
> <xsl:template match="row">
> <xsl:element name="{cell[1]}">
> <xsl:value-of
> select="normalize-space(cell[2])"/>
> </xsl:element>
> </xsl:template>
>
> <!--xsl:template match="row" xsl:space="preserve">
> <ligne>
> <xsl:apply-templates/>
> </ligne>
> </xsl:template>
>
> <xsl:template match="cell" xsl:space="preserve">
> <cellule>
> <xsl:apply-templates/>
> </cellule>
> </xsl:template-->
>
> <xsl:template match="dl">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="dd">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="dt">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="note">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="attention">
> <xsl:apply-templates/>
> </xsl:template>
>
>
> <xsl:template match="kw" xsl:space="preserve">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="link[@url]">
> <lien>
> <xsl:attribute name="href">
> <xsl:value-of select="@url"/>
> </xsl:attribute>
> <xsl:apply-templates/>
> </lien>
> </xsl:template>
>
> <xsl:template match="b">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="u">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="i">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="tm">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="exemple">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="graphic">
> <image>
> <xsl:attribute name="SRC">
> <xsl:value-of select="@url"/>
> </xsl:attribute>
> </image>
> </xsl:template>
> </xsl:stylesheet>
>
> and this is the xml file :
>
> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
> <?xml:stylesheet type="text/xsl" href="mydoc.xsl"?>
> <mydoc>
> <h1>
> <ht>Introduction :</ht>
> </h1>
> <h1>
> <ht>Historiques des évolutions :</ht>
> <h2>
> <ht>A- Evolutions de la V5.3 :</ht>
> <table>
> <row>
>
> <cell width="121">
>
> <p>Partie modifiée</p>
> </cell>
> <cell width="337">
>
> <p>Evolution</p>
> </cell>
> </row>
>
> <row>
>
> <cell width="121">
>
> <p>Identification des
> règles</p>
> </cell>
> <cell width="337">
>
> <p>Modification
> de forme :
> COD07 devient COD07RA</p>
> </cell>
> </row>
>
> <row>
>
> <cell width="121">
>
> <p>B006</p>
> </cell>
> <cell width="337">
>
> <p>Renvoi vers
> le tableau
> paramètre de l'assimilation</p>
> </cell>
> </row>
>
> <row>
>
> <cell width="121">
>
> <p>Paramètre P008</p>
> </cell>
> <cell width="337">
>
> <p>Assimilation de la
> formation</p>
> </cell>
> </row>
> </table>
> </h2>
> </h1>
> </mydoc>
>
> Thank for helping
>
>
> +----------------------------------------------------------------+
> | Ce courrier ainsi que les fichiers joints sont confidentiels. |
> | Si vous avez recu ce courrier par erreur, veuillez en informer |
> | l'administrateur du systeme : exp-iris@unedic.fr |
> | --------- |
> | Ce message confirme que le courrier a passe le controle |
> | antivirus du relais de messagerie Internet avec succes. |
> +----------------------------------------------------------------+
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list