RE: [xsl] new user xslt

Subject: RE: [xsl] new user xslt
From: DPawson@xxxxxxxxxxx
Date: Tue, 30 Apr 2002 09:10:16 +0100
I think this is one of the reasons I stick with Saxon.
Its error (and problem area) reporting is so good.
Far fewer (Homer style) duh! moments.... or at least
they come sooner rather than later.

Regards DaveP



> 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@xxxxxxxxxxxx
> work: Michael.Kay@xxxxxxxxxxxxxx
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> > CHAOUI Hassan
> > Sent: 29 April 2002 11:00
> > To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> > 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 = &quot;bullet&quot;]">
> > 		<bullet>
> > 			<xsl:apply-templates/>
> > 		</bullet>
> > 	</xsl:template>
> >
> > 	<xsl:template match="list[@style = &quot;numeric&quot;]">
> > 		<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@xxxxxxxxx               |
> > |                          ---------                             |
> > | 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

- 

NOTICE: The information contained in this email and any attachments is 
confidential and may be legally privileged. If you are not the 
intended recipient you are hereby notified that you must not use, 
disclose, distribute, copy, print or rely on this email's content. If 
you are not the intended recipient, please notify the sender 
immediately and then delete the email and any attachments from your 
system.

RNIB has made strenuous efforts to ensure that emails and any 
attachments generated by its staff are free from viruses. However, it 
cannot accept any responsibility for any viruses which are 
transmitted. We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email 
and any attachments are those of the author and do not necessarily 
represent those of RNIB.

RNIB Registered Charity Number: 226227

Website: http://www.rnib.org.uk 

14th June 2002 is RNIB Look Loud Day - visit http://www.lookloud.org.uk to
find out all about it.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread