OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook-apps] Request for help with XSL: template for processinginstruction not getting called

Taro Ikai wrote:
> Jirka asked:
>>And how does this template looks. It must contain <xsl:apply-templates/> 
>>in order to invoke templates for child nodes including PI nodes.
> As you see in my <xsl:template match="*" mode="hh-alias">, it does
> call <xsl:apply-templates select="*" mode="hh-alias"/>.
> *** At this point, I realized this is the problematic line.
> The select expression "*" does not catch processing instructions.
> If I say simply <xsl:apply-templates/>, the processing does not seem
> to recurse correctly. I only get output from the root node.
> I don't know why. Perhaps someone can teach me why.
> When I tried this I was successful:
>   <xsl:apply-templates mode-"hh-alias"/>
> The following also works:
>   <xsl:apply-templates select="*|processing-instruction()" 
> mode-"hh-alias"/>
> So the XSL lesson I learned was that "*" does not match processing 
> instructions.
> But I still don't know why the simple rule <xsl:apply-templates/> does not
> recurse into child nodes.
> -Taro

Jirka gave the vital reason for the problem: you changed the default 
tree processing by specifying to work only down to child elements using 
<xsl:apply-templates select="*" mode="hh-alias"/>. So it was not a wrong 
matching but the wrong processing. With select="*" you prevented the 
applying of the template on the processing instructions.

<xsl:apply-templates/> does of course not work, because you want to have 
the templates matched in a specific mode "hh-alias", so you need to 
specify this mode when calling the next processing step. With the modes 
you can bring up parallel processings, with the mode="" on 
<xsl:apply-templates/> you choose which of the processings you want to 
select. See http://www.w3.org/TR/xslt#modes for more information. Using 
apply-templates without mode the stylesheet *does* recurse into child 
nodes, but I guess you have no specific templates handling this (so the 
built-in templates are used, http://www.w3.org/TR/xslt#built-in-rule) or 
you catch this processing anywhere by having <xsl:template match="*"/>.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]