Wendell Piez wrote:
<xsl:when test="$current-node/node()[1][self::text()]">
<xsl:text>NO TAG, JUST TEXT, WRITE FONT_DECL</xsl:text>
</xsl:when>
Just tested it, it works (!), and I also found my mental error, I tried
with:
$current-node/node()[1]/text() --- returns all text nodes inside
descendants
$current-node/node()/self::text() --- returns all text nodes that are
direct children
just didn't think of the third and correct combination you just gave me.
Thanks!
... but given your case, don't you want the font_decl *any* time you
have a text node child (even in the middle or at the end)? So
"$current-node/text()" would be the test?
No, not in the current situation, but I am indeed looking for a better
design.
If it passes the test, I think you probably want to shift into a
special mode:
<xsl:template match="*" mode="font-wrapper">
<xsl:template match="text()" mode="font-wrapper">
This is what I had, indeed. But because of the irregular winding up/down
of the styles for my target format, it got quite messy and I thought of
using functions. But perhaps I should reconsider and use more modes (I
have some already ;-) )
In any case I suspect that even if this doesn't do the trick, a
special mode offers you a much nicer and more general solution to your
problem.
Agreed.
Similarly, I wonder if you really want or need a function to do this.
In XSLT we can "micro-pipeline", using templates to process the
results of using templates; the function looks to me like it's only
adding extra overhead.
Please forgive me if I've understood the problem incorrectly.
I think you understood it perfectly. Even though I sometimes think I am
grasping it all, XSLT hits me again around the corner, but that makes it
one of the most joyful and surprising languages I have ever worked with.
Thanks again!
Cheers,
-- Abel
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--