Loading ...
Sorry, an error occurred while loading the content.

Re: [xml-doc] Iteration in XSLT

Expand Messages
  • Christopher R. Maden
    ... Hash: SHA1 ... Careful there - XSLT is not formally tail-recursive. You can certainly write a tail-recursive template, but a processor is not required to
    Message 1 of 12 , Dec 12, 2001
    • 0 Attachment
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1

      At 09:50 12-12-2001, Isaac Rabinovitch wrote:
      >What's different about recursion in XSLT is a feature called "tail
      >recursion".

      Careful there - XSLT is not formally tail-recursive. You can certainly
      write a tail-recursive template, but a processor is not required to
      optimize it or recognize it as tail-recursive (as a Scheme processor would
      be), and so you can still get stack overruns in some processors.

      ~Chris
      - --
      Christopher R. Maden, Principal Consultant, HMM Consulting Int'l, Inc.
      DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
      <URL: http://www.hmmci.com/ > <URL: http://crism.maden.org/consulting/ >
      PGP Fingerprint: BBA6 4085 DED0 E176 D6D4 5DFC AC52 F825 AFEC 58DA
      -----BEGIN PGP SIGNATURE-----
      Version: PGP Personal Privacy 6.5.8

      iQA/AwUBPBfaSaxS+CWv7FjaEQKtSACgwKYqOA5qTIFSpkXeWJfP8xfMyNgAnRS6
      gjAdGqhAZp7sfDP0NJlZZLwE
      =Z1YN
      -----END PGP SIGNATURE-----
    • Isaac Rabinovitch
      ... Ugh. Thanks for the warning. I m new to XSLT, so I shouldn t pass judgment. But just because W3C says that tail-recursion isn t a necessary feature of XSLT
      Message 2 of 12 , Dec 12, 2001
      • 0 Attachment
        "Christopher R. Maden" wrote:

        >
        > Careful there - XSLT is not formally tail-recursive. You can certainly
        > write a tail-recursive template, but a processor is not required to
        > optimize it or recognize it as tail-recursive (as a Scheme processor would
        > be), and so you can still get stack overruns in some processors.

        Ugh. Thanks for the warning. I'm new to XSLT, so I shouldn't pass judgment.
        But just because W3C says that tail-recursion isn't a necessary feature of
        XSLT processors, doesn't mean it's something we can live without. I would
        really resist using a processor without tail recursion in a production
        environment.

        Two reasons for this. First the processor could theoretically choke on a
        sufficiently convoluted XML document. I suppose that's probably a remote
        possibility.

        But consider: this is a very basic optimization. If the developer can't be
        bothered to do this, how efficient can the processor as a whole be?
      • Christopher R. Maden
        ... Hash: SHA1 ... That s a very good point - this kind of qualification is definitely a mark of quality in an XSLT engine. Now I suppose I ve got to stop
        Message 3 of 12 , Dec 13, 2001
        • 0 Attachment
          -----BEGIN PGP SIGNED MESSAGE-----
          Hash: SHA1

          At 17:49 12-12-2001, Isaac Rabinovitch wrote:
          >But consider: this is a very basic optimization. If the developer can't be
          >bothered to do this, how efficient can the processor as a whole be?

          That's a very good point - this kind of qualification is definitely a mark
          of quality in an XSLT engine.

          Now I suppose I've got to stop pontificating and go do some actual research...

          SAXON supports it as of v5.3.

          4XSLT supports it as well, as of at least October 2000.

          MSXML may...

          Finding information at this level of detail about implementations seems
          tricky. From some bug reports I've seen, I suspect that Xalan does not. I
          would be a bit surprised, knowing the developers, if XT and libxslt didn't.

          FWIW, SAXON is my engine of choice, though I need to take a good look at
          libxslt.

          ~Chris
          - --
          Christopher R. Maden, Principal Consultant, HMM Consulting Int'l, Inc.
          DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
          <URL: http://www.hmmci.com/ > <URL: http://crism.maden.org/consulting/ >
          PGP Fingerprint: BBA6 4085 DED0 E176 D6D4 5DFC AC52 F825 AFEC 58DA
          -----BEGIN PGP SIGNATURE-----
          Version: PGP Personal Privacy 6.5.8

          iQA/AwUBPBhuUaxS+CWv7FjaEQKcagCfYAA2eYoL9GlSQ67lyYJuZJ2YRvgAoITw
          HqJXMofOj/BBsej6tPrK2dfD
          =WOBw
          -----END PGP SIGNATURE-----
        • Isaac Rabinovitch
          ... Sha na na na, sha boom. ... Easy enough to test -- just program an infinite recursion. If you end up having to interrupt the program after 20 minutes or
          Message 4 of 12 , Dec 13, 2001
          • 0 Attachment
            "Christopher R. Maden" wrote:

            > -----BEGIN PGP SIGNED MESSAGE-----
            > Hash: SHA1
            >

            Sha na na na, sha boom.

            >
            >
            > MSXML may...
            >
            > Finding information at this level of detail about implementations seems
            > tricky. From some bug reports I've seen, I suspect that Xalan does not. I
            > would be a bit surprised, knowing the developers, if XT and libxslt didn't.
            >

            Easy enough to test -- just program an infinite recursion. If you end up having to
            interrupt the program after 20 minutes or so, you're fine. If it crashes by
            itself...
          • Dave Pawson
            ... Especially since Daniel bites when you crit his work :-) I m becoming more and more impressed with it. Especially since its a new boy on the block ?
            Message 5 of 12 , Dec 13, 2001
            • 0 Attachment
              At 01:01 13/12/2001 -0800, Christopher R. Maden wrote:

              >FWIW, SAXON is my engine of choice, though I need to take a good look at
              >libxslt.

              Especially since Daniel bites when you crit his work :-)

              I'm becoming more and more impressed with it.
              Especially since its a 'new boy on the block'?

              Regards DaveP
            • Norman Walsh
              ... It s nice. I just haven t rewritten the extension functions I use in C yet, so I m still using Saxon for lots of things. Be seeing you, norm -- Norman
              Message 6 of 12 , Jan 3, 2002
              • 0 Attachment
                / "Christopher R. Maden" <crism@...> was heard to say:
                | FWIW, SAXON is my engine of choice, though I need to take a good look at
                | libxslt.

                It's nice. I just haven't rewritten the extension functions I use in C
                yet, so I'm still using Saxon for lots of things.

                Be seeing you,
                norm

                --
                Norman Walsh <normyahoo@...> | Things work out best for those
                http://nwalsh.com/ | who make the best of the way
                | things work out.
              Your message has been successfully submitted and would be delivered to recipients shortly.