Is it possible with XPATH/XSLT 1.0 to select all attributes ending with "Foo"?
I'm writing some XSLT to get the list of all values of all attributes for all "InterestingElement"s where the attribute name ends with "Foo".
Actually I also want to filter out those where the value is empty ""
I tried specifying a stylesheet for XSLT 2.0 but got xsl:version: only 1.0 features are supported
:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes">
So far I have:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:for-each select="//InterestingElement">
<xsl:value-of select="__what goes here?__"/><xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:text>end</xsl:text>
</xsl:template>
</xsl:stylesheet>
And here's some sample XML:
<?xml version="1.0"?>
<root>
<Other Name="Bob"/>
<InterestingElements>
<InterestingElement AttrFoo="want this"
Attr2Foo="this too"
Blah="not this"
NotThisFoo=""/>
</InterestingElements>
</root>