Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. An XSLT version of an old favourite

An XSLT version of an old favourite

Scheduled Pinned Locked Moved The Weird and The Wonderful
xmlannouncement
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rob Grainger
    wrote on last edited by
    #1

    Within one of my company's XSLT document's, I came across the following. Seems to be an XSLT version of a familiar coding horror... <xsl:for-each select="fl:values/fl:dataItem[@field='fl_name']> <xsl:if test="position()=1"> _Output Here_ </xsl:if> </xsl:for-each>

    D 1 Reply Last reply
    0
    • R Rob Grainger

      Within one of my company's XSLT document's, I came across the following. Seems to be an XSLT version of a familiar coding horror... <xsl:for-each select="fl:values/fl:dataItem[@field='fl_name']> <xsl:if test="position()=1"> _Output Here_ </xsl:if> </xsl:for-each>

      D Offline
      D Offline
      Doc Lobster
      wrote on last edited by
      #2

      From time to time it is necessary for me to code xslt. Each time is a horror. the horror the horror

      R N S 3 Replies Last reply
      0
      • D Doc Lobster

        From time to time it is necessary for me to code xslt. Each time is a horror. the horror the horror

        R Offline
        R Offline
        Rob Grainger
        wrote on last edited by
        #3

        Personally, I'm torn. I do like the declarative nature of specifying transforms on XML documents. However, two problems remain: 1. XML. Fine for structured data passing between systems. I use it regularly for these purposes. However, as a programming language, I'd say it leaves something to be desired. I'm a C-family developer (C++, Java, C#) and appreciate the terseness, so XSLT makes me shudder with its verbosity. 2. As with many scripting languages, if used well code is fairly readable, but put it in the hands of a less capable developer, and the source is virtually unreadable. Obviously what we need is an XSLT transform to transform badly written XSLT into well-written XSLT ;), and a transform to render (and the reverse) XSLT to more user- (i.e. developer) friendly syntax.

        D 1 Reply Last reply
        0
        • D Doc Lobster

          From time to time it is necessary for me to code xslt. Each time is a horror. the horror the horror

          N Offline
          N Offline
          Nemanja Trifunovic
          wrote on last edited by
          #4

          Doc Lobster wrote:

          From time to time it is necessary for me to code xslt. Each time is a horror.

          Eh, not so sure about that. Sure, the syntax is horrible, but the semantics make sense IMHO.

          Programming Blog utf8-cpp

          1 Reply Last reply
          0
          • D Doc Lobster

            From time to time it is necessary for me to code xslt. Each time is a horror. the horror the horror

            S Offline
            S Offline
            Shog9 0
            wrote on last edited by
            #5

            From time to time, it is necessary for me to review procedural XML translation code from people who don't know how to use XSLT. Each time is a horror... ;)

            But who is the king of all of these folks?

            R 1 Reply Last reply
            0
            • R Rob Grainger

              Personally, I'm torn. I do like the declarative nature of specifying transforms on XML documents. However, two problems remain: 1. XML. Fine for structured data passing between systems. I use it regularly for these purposes. However, as a programming language, I'd say it leaves something to be desired. I'm a C-family developer (C++, Java, C#) and appreciate the terseness, so XSLT makes me shudder with its verbosity. 2. As with many scripting languages, if used well code is fairly readable, but put it in the hands of a less capable developer, and the source is virtually unreadable. Obviously what we need is an XSLT transform to transform badly written XSLT into well-written XSLT ;), and a transform to render (and the reverse) XSLT to more user- (i.e. developer) friendly syntax.

              D Offline
              D Offline
              Doc Lobster
              wrote on last edited by
              #6

              Well, I don't create XSLTs on a daily basis, only once a month. Each time I have to go back to look at already created ones to see how to do it. It just doesn't seem natural to me, especially dealing with variables and parameters. When I look at XSLTs in bigger projects that have been worked on for a while (by other people) - it makes XSL to look like a self-obfuscating language. People tend to put the whole application into one file (doesn't matter if it got 10.000 lines), do not properly group things, use copy & paste and the rest is done by the overhead of tags and symbols through XML. It makes me think XSL is generally treated as throw-away code, like prototypes going into production.

              S 1 Reply Last reply
              0
              • S Shog9 0

                From time to time, it is necessary for me to review procedural XML translation code from people who don't know how to use XSLT. Each time is a horror... ;)

                But who is the king of all of these folks?

                R Offline
                R Offline
                Rob Grainger
                wrote on last edited by
                #7

                Spot on - I'm having just such a horror going through current use in my project. I think though that many developer's expect just to leap into XSLT as with most languages, without observing that it requires a paradigm shift from imperative to declarative logic. Still hate the syntax though. XML is just way to verbose for some applications. I've heard justifications that a tree-like structure is well suited to such tasks, but as far I'm aware most parsers form a tree (Abstract Syntax Tree) representing the program structure, so that doesn't cut ice with me.

                1 Reply Last reply
                0
                • D Doc Lobster

                  Well, I don't create XSLTs on a daily basis, only once a month. Each time I have to go back to look at already created ones to see how to do it. It just doesn't seem natural to me, especially dealing with variables and parameters. When I look at XSLTs in bigger projects that have been worked on for a while (by other people) - it makes XSL to look like a self-obfuscating language. People tend to put the whole application into one file (doesn't matter if it got 10.000 lines), do not properly group things, use copy & paste and the rest is done by the overhead of tags and symbols through XML. It makes me think XSL is generally treated as throw-away code, like prototypes going into production.

                  S Offline
                  S Offline
                  Shog9 0
                  wrote on last edited by
                  #8

                  Doc Lobster wrote:

                  People tend to put the whole application into one file (doesn't matter if it got 10.000 lines), do not properly group things, use copy & paste and the rest is done by the overhead of tags and symbols through XML.

                  Ouch. Well, slap 'em around a bit. There's just no excuse for that.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups