• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Xsl

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #91
    No, no no - this would count ALL true nodes, but I need to count all true nodes consequtively from start: its okay to have more true nodes after first false, but I need count of the first ones only. Go on try it.

    Comment


      #92
      Originally posted by Cowboy Bob
      Learn the tool before slagging it off.
      Show me how to solve my problem using XSLT - after lots of digging and bitching I found solution, not very functional but it works, now go on give me your solution, and if you don't know how then I know XSLT better than you, and as such my words carry a bit more weight.

      Comment


        #93
        In that case

        You find all false nodes using XPath

        Use position and first child functions to find first false node.

        Last true node is this value (poistion) -1.

        No loops, no ifs

        Comment


          #94
          Originally posted by AtW
          Show me how to solve my problem using XSLT - after lots of digging and bitching I found solution, not very functional but it works, now go on give me your solution, and if you don't know how then I know XSLT better than you, and as such my words carry a bit more weight.
          You don't want to solve your problem. Seriously. If you have a problem like that it's because you're approaching the problem from the wrong direction. Finding workarounds is going to leave you with the kind of template that is going to be a mess and understandable by nobody.

          The real solution to your problem is to use an XPath that only selects the data you want, just as DimPrawn suggested.
          Listen to my last album on Spotify

          Comment


            #95
            Now that's getting warmer, but where you going to put those found nodes?

            Into "variable", yes you can - problem is that you can't query that variable because the data you put into it won't be node-set! That's right, even if its proper full XML put into variable the damn thing will consider it tree fragment and you can't check first node, you can't query it you can't do sh1t.

            So obviously you need to query that variable and for this to turn it to node-set. Now, this seems rather obvious - if its valid XML then it should be not an issue for XSL to convert it to node-set and let you query it and do stuff, but how?

            Well, you can't do that if you just use pure XSL, just like ANSI SQL can't loop. Vendor specific extention is necessary, like Microsoft's msxsl:node-set. Now this works but you XSL is no longer standart, and for God's sake why such an obviously necessary function was omitted from required list of functions?

            Comment


              #96
              Originally posted by Cowboy Bob
              The real solution to your problem is to use an XPath that only selects the data you want, just as DimPrawn suggested.
              LOL due, then give me that magical XPath! All those XSL looneys just say - for-each is not a loop you don't need break out it, just select what you need using XPath, then tell me that Xpath, how to select first X nodes that satisfy given criteria and stop at the node which stopped satisfying it even if there are more nodes for satisfying criteria are left, go on show me XPath for that.

              Comment


                #97
                The power of XSLT is in the XPATH.

                Until you fully understand what you can do to find matching nodes (or non matching nodes) with XPATH you won't get antwhere.

                Comment


                  #98
                  I do not believe it is possible to select FIRST X nodes satisfying given criteria (true in our case) and stop matching immediately after first node that fails such criteria - thus excluding possibly further nodes that satisfy that criteria: prove it otherwise please, I would appreciate it a lot and will shut up about XSL for 24 hours (until I hit some other brick wall).

                  Comment


                    #99
                    And while you at it, give me XPath that would do the following: match attribute with values where Attribute name is supplied during run-time, ie not fixed once, ie something liek this:

                    <xsl:for-each select="/Rows/Row[$AttributeName='test'"/>

                    Note: this appears to be unsupported by Xpath: Variables can be used in place of values but not attribute name.

                    Comment


                      Originally posted by AtW
                      LOL due, then give me that magical XPath! All those XSL looneys just say - for-each is not a loop you don't need break out it, just select what you need using XPath, then tell me that Xpath, how to select first X nodes that satisfy given criteria and stop at the node which stopped satisfying it even if there are more nodes for satisfying criteria are left, go on show me XPath for that.
                      I'd be happy to solve your XSLT problems - for a fee
                      Listen to my last album on Spotify

                      Comment

                      Working...
                      X