|
Subject: RE: [xsl] Embedded bold,italic,anchors etc. From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Wed, 11 Jun 2008 16:48:53 +0100 |
Yes, you're doing a lot of this kind of thing:
<xsl:for-each select="p">
<p><xsl:value-of select="." /></p>
</xsl:for-each>
when you should be doing
<xsl:apply-templates select="p"/>
Value-of essentially causes the markup from this point down in the tree to
be ignored.
In fact, generally, you're making far too much use of for-each and value-of
than is healthy in a document-oriented transform. Try to use rule-based
recursive descent processing (often called "push processing") all the way
down. The coding style should be, except where something else is needed,
that each element matches a template rule, which does something specific to
that element and then does apply-templates to its children.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Craig Riley [mailto:craig@xxxxxxxxxxxxxxxxxx]
> Sent: 11 June 2008 16:10
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Embedded bold,italic,anchors etc.
>
> Wow some great responses (and the usual not so great ones :)
>
> The reason I did not supply any code is because a) This was
> one of the first things I tried to do and because it didn't
> work I deleted the code, b) the code I have now is quite
> large and c) I just wanted a nudge in right direction so I
> wrote an example peice of code out.
>
> From what I have read I was probably using the value-of
> instead of the recursive technique somebody suggested. For
> what it's worth this is the code I have to date, I'm sure
> there's tons of things wrong with it but that's part of
> learning! I can already see I'm not using templates nowhere
> near enough! :(
>
> Thanks again for the helpful emails
>
> Cheers
>
> Craig
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Embedded bold,italic,anch, Craig Riley | Thread | Re: [xsl] Embedded bold,italic,anch, Wendell Piez |
| Re: [xsl] Oracle XSLT 2.0 processor, Andrew Welch | Date | Re: [xsl] searching for occurrences, Wendell Piez |
| Month |