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.
- 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
Collapse
-
-
Originally posted by Cowboy BobLearn the tool before slagging it off.Comment
-
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 ifsComment
-
Originally posted by AtWShow 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.
The real solution to your problem is to use an XPath that only selects the data you want, just as DimPrawn suggested.Comment
-
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
-
Originally posted by Cowboy BobThe real solution to your problem is to use an XPath that only selects the data you want, just as DimPrawn suggested.Comment
-
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
-
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
-
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 AtWLOL 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
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- How 15% employer NICs will sting the umbrella company market Yesterday 09:16
- Contracting Awards 2024 hails 19 firms as best of the best Nov 18 09:13
- How to answer at interview, ‘What’s your greatest weakness?’ Nov 14 09:59
- Business Asset Disposal Relief changes in April 2025: Q&A Nov 13 09:37
- How debt transfer rules will hit umbrella companies in 2026 Nov 12 09:28
- IT contractor demand floundering despite Autumn Budget 2024 Nov 11 09:30
- An IR35 bill of £19m for National Resources Wales may be just the tip of its iceberg Nov 7 09:20
- Micro-entity accounts: Overview, and how to file with HMRC Nov 6 09:27
- Will HMRC’s 9% interest rate bully you into submission? Nov 5 09:10
- Business Account with ANNA Money Nov 1 15:51
Comment