[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Aargh - wrong template applied


Subject: RE: [xsl] Aargh - wrong template applied
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 19 Apr 2006 08:19:24 +0100

You haven't shown your source document, but my guess is that your font
elements are in a namespace.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Ian Eure [mailto:ieure@xxxxxxxxxx] 
> Sent: 19 April 2006 01:08
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Aargh - wrong template applied
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I'm sure this is something simple I'm overlooking, but I just 
> can't make this work.
> 
> I have this stylesheet:
> 
> <xsl:stylesheet version='1.0'
> 		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> 		xmlns:gale="http://www.gale.com/eBook"
> 		xmlns:php="http://php.net/xsl"
> 		exclude-result-prefixes="gale php">
> 
>      <xsl:output method="xml"
>                  version="1.0"
>                  indent="yes"
>                  encoding="utf-8"
>                  omit-xml-declaration="yes"/>
> 
>      <xsl:template match="@*|node()">
> 	<xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
>      </xsl:template>
> 
>      <xsl:template match="font">
>          <xsl:apply-templates/>
>      </xsl:template>
> 
> </xsl:stylesheet>
> 
> I want to pass through the document as-is in most cases, but 
> make certain changes elsewhere. I have a generic pass-through 
> rule, and a more specific rule to strip out <font> elements, 
> but retain their children. However, the latter template is 
> never called, and I can't figure out why.
> 
> I'm using XSLTProc. Turning on it's verbose mode gives me 
> some relevant information:
> 
> added pattern : '@*' priority -0.500000
> added pattern : 'node()' priority -0.500000 added pattern : 
> 'font' priority 0.000000
> 
> Looks good, but then:
> 
> xsltProcessOneNode: applying template '@*|node()' for font
> 
> Why isn't the latter template ever applied, and how do I get 
> the behavior I want?
> 
> - --
> Ian Eure
> Developer,
> eNotes.com LLC
> 
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (Darwin)
> 
> iD8DBQFERX9fxuUdPD6j2IMRAjcnAJ957AsILKXEZNC7JcwMa+LzoOeADgCfTjr4
> esWfqHwRvCfITqeNmOeaUcQ=
> =KsVw
> -----END PGP SIGNATURE-----


Current Thread