- Joined
- Oct 25, 2007
- Messages
- 17,534
- Likes received
- 6
- Thanks received
- 5
That's what I call short term planning - no wonder the West is going downhill...
What are your plans for SKA in 2100?
That's what I call short term planning - no wonder the West is going downhill...
What are your plans for SKA in 2100?
Whoever named them "functional" is a retard or it's a sick joke - just search for my ranks in Technical, look for XSLT / XPATH keyrods![]()
JavaScript has been in active use as a functional language

What are your plans for SKA in 2100?
XSLT (and anything like it) was designed by people either high up in academia or high on drugs, most likely both - you can't fking use "variable" keyword to define a constant that can't change value, it's not a fking variable!![]()
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:variable name="currentValue">No value</xsl:variable>
<xsl:template match="values">
<xsl:text>Global value of $currentValue is </xsl:text>
<xsl:value-of select="$currentValue"/>
<xsl:text>
</xsl:text>
<xsl:apply-templates select="value"/>
</xsl:template>
<xsl:template match="value">
<xsl:variable name="currentValue" select="text()"/>
<xsl:text>Current value of $currentValue is </xsl:text>
<xsl:value-of select="$currentValue"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<values>
<value>Foo</value>
<value>Bar</value>
<value>AtW</value>
</values>
Global value of $currentValue is No value
Current value of $currentValue is Foo
Current value of $currentValue is Bar
Current value of $currentValue is AtW

Some people even think <xsl:for-each> is a looping construct, FFS![]()



It's a variable in a mathematical sense.



And it isn't?
All I wanted to do with this tulipy XSLT is to loop through some data and do some aggregations!
And don't give me that XPath tulip about doing sums in calls - that wasn't working in .NET - the whole thing is a load of tosh!![]()
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:template match="elements">
<xsl:text>Sum of element values is </xsl:text>
<xsl:value-of select="sum(element/@value)"/>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<elements>
<element value="1"/>
<element value="2"/>
<element value="3"/>
<element value="4"/>
<element value="5"/>
<element value="6"/>
</elements>
Sum of element values is 21
