Denseman on the Rattis

Formerly known as the Widmann Blog

enIT

XSLT syntax


XSLT, Sexy?
Originally uploaded by mollyeh11

I taught myself XSLT last Thursday, and I must admit I’m in two minds about it.

On the one hand, it’s a really nice way to deal with many common transformations, but on the other hand, I’m getting sick and tired of typing <xsl: all the time.

It’d be really nice to have a preprocessor to transform a somewhat saner syntax to real XSLT. What I imagine is something that would allow me to write something like this:

      exec entity-ref (name="nbsp");
      print "<b>\n";
      if xsl:* {
          print "x"
      }
      print "</b>\n";
      print $name(.);

instead of this:

      <xsl:call-template name="entity-ref">
         <xsl:with-param name="name">nbsp</xsl:with-param>
      </xsl:call-template>
      <b>
      <xsl:if test="xsl:*">
          <xsl:text>x</xsl:text>
      </xsl:if>
      </b>
      <xsl:value-of select="name(.)"/>

Has anybody done that yet? Or will I have to do that myself if I want it badly enough? Is there any good reason for not doing it (apart from not getting begin and end tags matched for free in cases such as <b>...</b> above)?

Leave a Reply

Your email address will not be published. Required fields are marked *