|
From: Jonathan S. <jn...@ge...> - 2003-06-24 16:13:20
|
On Tue, 24 Jun 2003, Iain Tatch wrote:
> On Tuesday, June 24, 2003, 2:13:50 PM, Jonathan Stowe wrote:
>
> >> Pure Perl XSLT was unsupported and incomplete last I heard.
> >>
>
> JS> Oi! Less of the unsupported matey. All patches welcome.
>
> [ .. offlist reply .. ]
>
> Hmmm that's a point.
>
> Just (finally) started taking a look at XML::XSLT to try to get it moved
> along a little bit. My first step is to get it to successfully process
> some stylesheets that I'm currently transforming via Xalan (C++ not Java).
> Much of this is probably going to revolve around getting xsl:variable
> more fully implemented, but the first snag I hit was
>
> line 704:
Well its more like line 771 in the CVS version :-)
> if ($match && $name) {
> $self->warn(qq{defining a template with both a "name" and a "match" attribute is not allowed!});
>
> Is this the case according to the XSL specs? As far as I can make out from
> http://www.w3.org/TR/xslt section 5.3 it's perfectly permissable to have
> both. Ditto with the DTD from the same URI (yuk I *hate* DTDs!) but if I'm
> reading it correctly:
>
> <!ATTLIST xsl:template
> match %pattern; #IMPLIED
> name %qname; #IMPLIED
> priority %priority; #IMPLIED
> mode %qname; #IMPLIED
> %space-att;
> >
>
I think that you are correct the spec actually says:
If an xsl:template element has a name attribute, it may, but need not,
also have a match attribute.
I think probably this might need a little work on conflict resolution but
I can't see any reason for it not to go in. On closer inspection of the
spec I think that this bit might need fixing to comply with:
The match attribute is required unless the xsl:template element has a
name attribute
as well. However I am going to go with:
--- XSLT.pm 18 Feb 2002 09:05:14 -0000 1.19
+++ XSLT.pm 24 Jun 2003 16:01:34 -0000
@@ -765,22 +765,10 @@
foreach my $template (reverse $self->templates()) {
if ($template->getParentNode->getTagName =~
/^([\w\.\-]+\:){0,1}(stylesheet|transform|include)/) {
- my $match = $template->getAttribute ('match');
- my $name = $template->getAttribute ('name');
- if ($match && $name) {
- $self->warn(qq{defining a template with both a "name" and a
"match" attribute is not allowed!});
- push (@{$self->{TEMPLATE_MATCH}}, "");
- push (@{$self->{TEMPLATE_NAME}}, "");
- } elsif ($match) {
- push (@{$self->{TEMPLATE_MATCH}}, $match);
- push (@{$self->{TEMPLATE_NAME}}, "");
- } elsif ($name) {
- push (@{$self->{TEMPLATE_MATCH}}, "");
- push (@{$self->{TEMPLATE_NAME}}, $name);
- } else {
- push (@{$self->{TEMPLATE_MATCH}}, "");
- push (@{$self->{TEMPLATE_NAME}}, "");
- }
+ my $match = $template->getAttribute ('match') || '';
+ my $name = $template->getAttribute ('name') || '';
+ push (@{$self->{TEMPLATE_MATCH}}, $match);
+ push (@{$self->{TEMPLATE_NAME}}, $name);
}
}
}
for the time being. I'll look at the mandatory match later. This passes
all the current tests and I'll add a test for this specifically in a bit.
It's a good thing I ran a 'make test' as it generates a whole slew of
Subroutine XML::DOM::Text::print redefined at
/home/gellyfish/develop/xmlxslt/XML-XSLT/blib/lib/XML/XSLT.pm line 1109
with the perl 5.8.0 and XML::DOM 1.42 ...
/J\
|