[xslt] xsl:import and attribute-set precedence
- From: lodewijk reddwarf xs4all nl
- To: xslt gnome org
- Subject: [xslt] xsl:import and attribute-set precedence
- Date: Thu, 2 Aug 2001 02:09:42 +0200
hello,
I stumbled onto what I think is an libxslt bug. I'm trying to make a
stylesheet easily customizable by using attribute sets. the idea is just like
the example at http://www.w3.org/TR/xslt#import, to let another sheet import
it and set some attributes differently.
it appears libxslt doesn't handle the precendence as I would expect from
reading the specification.
take foo.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<blah>
</blah>
and foo1.xsl:
<?xml version="1.0"?>
<xsl:output method="html"/>
<xsl:attribute-set name="blah-style">
<xsl:attribute name="size">+1</xsl:attribute>
</xsl:attribute-set>
<xsl:template match="/">
<font xsl:use-attribute-sets="blah-style">foo</font>
</xsl:template>
</xsl:stylesheet>
and foo2.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="foo1.xsl"/>
<xsl:attribute-set name="blah-style">
<xsl:attribute name="size">+2</xsl:attribute>
</xsl:attribute-set>
</xsl:stylesheet>
now, running foo1.xsl I expect and get:
lodewijk$ xsltproc foo1.xsl foo.xml
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<font size="+1">foo</font>
okay. now, running foo2 I'd expect +2, not +1, but:
lodewijk$ xsltproc foo2.xsl foo.xml
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<font size="+1">foo</font>
the same. OTOH, XT gives what I expect:
lodewijk$ kaffe -classpath /usr/share/kaffe/Klasses.jar:/usr/share/java/repository com.jclark.xsl.sax.Driver foo.xml foo2.xsl
<font size="+2">foo</font>
as does Xalan. xsltproc -v shows it does try to update the attribute set, but
apparently that doesn't work:
lodewijk$ xsltproc -v foo2.xsl foo.xml
Added namespace: xsl mapped to http://www.w3.org/1999/XSL/Transform
xsltPrecomputeStylesheet: removing ignorable blank node
xsltParseStylesheetProcess : found stylesheet
Added namespace: xsl mapped to http://www.w3.org/1999/XSL/Transform
xsltPrecomputeStylesheet: removing ignorable blank node
xsltParseStylesheetProcess : found stylesheet
creating attribute set table
add attribute to list blah-style
updated attribute list blah-style
xsltCompilePattern : parsing '/'
xsltCompilePattern : parsed /, default priority 0.500000
added pattern : '/' priority 0.500000
parsed 1 templates
creating attribute set table
add attribute to list blah-style
updated attribute list blah-style
parsed 0 templates
Initializing keys on foo.xml
Registered 0 modules
Registering global variables
Registering global variables from foo2.xsl
Registering global variables from foo1.xsl
apply attribute set blah-style
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<font size="+1">foo</font>
is this a bug, or am I misunderstanding things?
Lodewijk
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]