Marc, himself, his blogs, and you reading them.
I'm far from an xslt expert, (those should know even better tricks and tools), but I've found the simple templates below a help at the bottom of any stylesheet under development.
Come to think of it, this might do very well as the first 30' of any XSLT course. Allowing people to just comment in/out these lines and watch/question/understand the effect should give some foundation to build the rest of the course upon.
Maybe a tip for Belgian ICT school teachers sending off their students into the big bad world to a training that actually requires the proclaimed XSLT knowledge.
5 6 <xsl:template match="text()" > 7 TEXT: <xsl:value-of select="." /> 8 </xsl:template> 9 10 <xsl:template match="@*"> 11 ATTR: <xsl:value-of select="name(.)" /> = <xsl:value-of select="." /> 12 </xsl:template> 13 14 <xsl:template match="*"> 15 ELM: <xsl:value-of select="name(.)" /> 16 <xsl:apply-templates select="@*"/> 17 <xsl:apply-templates select="*"/> 18 <xsl:apply-templates select="text()"/> 19 </xsl:template> 20# Posted by mpo at 03:20 PM | TrackBack
My java heritage probably makes me crave for the print-debug thing :-)
As for the HTML generation: It's done with gvim (http://vim.org). Just have syntax highlighting enabled and from the menu apply: Syntax | Convert to HTML
(feature available for all recognised syntaxes by the way... I should use this for java snippets as well of course!)
Posted by: -marc= at March 9, 2005 04:49 PMAnd if you have to do a lot of java printing to do (e.g. if you have to hand in your homework to the aforementioned ICT teachers)
find . -name "*.java" -exec vim -c ":runtime syntax/2html.vim" -c ":x" -c ":q" "{}" \;
add html2ps and lp straight away if you're feeling lucky
Posted by: karel at March 10, 2005 10:29 AMOh, cool trick! Not the XSLT templates, but the syntax coloring :-)
Posted by: Sylvain Wallez at March 10, 2005 12:24 PM

Or in my case:
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
I don't like the print debug thing, and people generally understand this quite well, especially when you start by providing them with an empty stylesheet where they see the effect of the default templates at work.
How do you do the fancy and nice coloured HTML code, BTW?
Posted by: Steven Noels at March 9, 2005 04:27 PM