XSL Select value of both attribute AND element
I'm working on an XSL stylesheet for some XML encoded finding aids. At the detailed description level for the contents of the collection, I have some containers like so:
<container type="folder">1</container>
开发者_JAVA技巧I need to select both the @type AND the number value in the container, however all I can manage to pull is the number. How should I structure my query to get folder 1
?
If current node is container:
<xsl:value-of select="concat(@type, ' ', text())"/>
Input XML:
<container type="folder">1</container>
XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="container">
<xsl:value-of select="concat(@type, ' ', text())"/>
</xsl:template>
</xsl:stylesheet>
Output:
folder 1
精彩评论