This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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="*"/>.

Joerg


To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]