Re: [xslt] overwriting attributes
- From: Daniel Veillard <veillard redhat com>
- To: xslt gnome org
- Subject: Re: [xslt] overwriting attributes
- Date: Tue, 23 Apr 2002 05:23:43 -0400
On Tue, Apr 23, 2002 at 11:14:52AM +0200, Janning Vygen wrote:
> Hi,
>
> i found something weired in xsltproc/libxslt. I searched the bug
> archive but didnt found anything.
>
> I produced an html file from an xml file and it shows up with two
> attributes of the same name in one element, which is an error, right?
>
> here is what i do: after parsing the sourcetree into chunks i want to
> add some default attributes to my html tags. So before writing to
> file i call an template with mode html.defaults.
>
> I found a workaround for me with many choose statements but thats not
> very nice.
>
> here comes a part of the xsl code...
>
> <xsl:template name="write.chunk">
> <xsl:param name="filename" select="''"/>
> <xsl:param name="method" select="'html'"/>
> <xsl:param name="encoding" select="'ISO-8859-1'"/>
> <xsl:param name="content" select="''"/>
>
> <saxon:output href="{$filename}"
> method="{$method}" encoding="{$encoding}"
> indent="{$indent}" xmlns:exslt="http://exslt.org/common">
> <xsl:apply-templates mode="html.defaults"
> select="exslt:node-set($content)"/>
> </saxon:output>
> </xsl:template>
>
> <!-- == doesnt work with xsltproc ====== -->
> <!-- default templates for copying the rest -->
> <!-- in html.defaults are left out to keep the example short -->
>
> <xsl:template match="table" mode="html.defaults">
> <xsl:copy use-attribute-sets="table.defaults">
> <xsl:for-each select="@*">
> <xsl:copy/>
> </xsl:for-each>
> <xsl:apply-templates mode="html.defaults"/>
> </xsl:copy>
> </xsl:template>
>
>
> normally the second attribute should owerwrite the first. At least
> Michael Kay say so in XSLT Programmers Reference and for me it seems
> to be convinient.
Hum, could you isolate this into a full small but complete XSLT
and the associated XML example so I can reproduce it easilly ?
thanks
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]