Re: [xsl] Simple template matching problem

Subject: Re: [xsl] Simple template matching problem
From: Steve <subsume@xxxxxxxxx>
Date: Mon, 7 May 2007 13:55:42 -0400
You're absolutely right. It seems that my processing scripts are, in
some cases, transforming XSL with no XML. Thanks for the reply.

-S

On 5/7/07, Abel Braaksma <abel.online@xxxxxxxxx> wrote:
Steve wrote:
> I want a template to match the root node of either default.xml or
> record.xml
>
> Right now it only succesfully matches record.xml
>
> default.xml
>
> <root>
>   <stuff />
> </root>
>
> record.xml
>
> <Records>
>   <Record />
> </Records>
>
> Current xsl:
>
> <xsl:template match="root | Records">
>  hey, hey. We are, in fact, the monkeys.
> </xsl:template>

I suppose you are missing something like:

<xsl:apply-templates select="document('record.xml')/*" />

the match itself in your code is correct for either. Can you send
something more of your code? In addition, look through your stylesheet
for something like match="/Records" or something like
match="Records[@id]" which both may have a higher precedence which can
be a reason for not matching 'Records' in the first place.

Another way to try your code is (carefully) replacing your
apply-templates with copy-of to see if you really select something in
apply-templates, or that you have some error in the namespace prefix,
the absence of one, or anything else that can be a cause of
non-selection (missing CamelCase?).

Cheers,
-- Abel

Current Thread