XSLT Built-in Template Rules for attributes

Posted by Martin Smith on Stack Overflow See other posts from Stack Overflow or by Martin Smith
Published on 2010-05-14T15:32:50Z Indexed on 2010/05/14 16:04 UTC
Read the original article Hit count: 350

Filed under:

I'm sure that this is an extremely basic question but here goes anyway! I have read that the built in template rule for text and attribute nodes in XSLT is

<xsl:template match="text()|@*">
  <xsl:value-of select="."/>
</xsl:template>

However for the source document

<?xml version="1.0"?>
<booker>
 <award>
  <author blah="test">Aravind Adiga</author>
  <title>The White Tiger</title>
  <year>2008</year>
 </award>
</booker>

And XSLT

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text"/>
</xsl:stylesheet>

I get the following output applying the transform in Visual Studio. Can someone please explain why I don't see "test" in the output?

Aravind Adiga

The White Tiger

2008

© Stack Overflow or respective owner

Related posts about xslt