If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Friday, April 23, 2010

xslt1.0 challenge

Someone on the xslt mailing list wanted to build a nice html table based on searchresults but the problem was not all searchresults had the same data.

I decided to give it a go and actually made the challenge a bit more difficult ;-)

Input:


Expected:


As you can see the tableheaders are sorted and the datarows should of course match up with the corresponding headers.

4 comments:

  1. Thank you for this.

    The code blocks here :



    with :
    XslTransformException
    ---------------------
    To use a result tree fragment in a path expression, first convert it to a node-set
    using the msxsl:node-set() function.


    The joy of xslt 1.0 with copy-of !!

    ReplyDelete
  2. oups blogger stripped the line :

    xsl:for-each select="$thead/thead/tr/th"

    ReplyDelete
  3. I'm curious to how this performs as to your own code which you got working... but i mean of course if you really stress test the code with a bug input file...

    ReplyDelete
  4. Well my poc is here : http://jeanph01.wordpress.com/2010/04/23/livelinkxmlsearch/

    and I took a couple of ideas from your code. thanks.

    ReplyDelete