Interesting Little Mystery for a Beginner
Posted: Mon Mar 23, 2009 5:12 am
I've tried to write a little XSLT (v 1.0) spec for digging the names of multiple authors out of the info section of a docbook (v5.0) document. I first got a couple little samples working fine. Yet, I just couldn't seem to get the xsl to traverse the list of authors in the docbook document. So, I pared the document back to include just the info section and then removed the schema identifier to make it look like just a specless xml doc. Then the transformation worked fine. All the document tags are exactly the same. Hmmm. Here's the xsl source. Can anybody suggest why this would work without the schema identifier in the document but not with it?
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<body>
<h2>Article Contributors</h2>
<xsl:for-each select="article/info/authorgroup/author/personname">
<p><xsl:value-of select="firstname"/> <xsl:value-of select="surname"/></p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<body>
<h2>Article Contributors</h2>
<xsl:for-each select="article/info/authorgroup/author/personname">
<p><xsl:value-of select="firstname"/> <xsl:value-of select="surname"/></p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>