Good morning: I hope you can help me I have the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<biblioteca>
<libro tipo="Novela">
<titulo>Don quijote</titulo>
<autor>Miguel de cervantes</autor>
</libro>
<libro tipo="teatro">
<titulo>Romeo y julieta</titulo>
<autor>William Shakespeare</autor>
</libro>
<libro tipo="cuento">
<titulo>El Aleph</titulo>
<autor>Jorge Luis Borges</autor>
</libro>
<libro tipo="poemas">
<titulo>Antologia</titulo>
<autor>Mario Benedetti</autor>
</libro>
</biblioteca>
And the following transformation xsl: fo:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="stxx">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="first"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="2cm"
margin-left="2.5cm"
margin-right="2.5cm">
<fo:region-body margin-top="3cm"/>
<fo:region-before extent="3cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<!--fo:table border-width="0.5mm" border-style="solid"--><!-- Marco para la tabla -->
<fo:table>
<fo:table-column column-width="3.2cm"/>
<fo:table-column column-width="3.2cm"/>
<fo:table-column column-width="3.2cm"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell border="solid black 1px" padding="2px"><fo:block>Titulo</fo:block></fo:table-cell>
<fo:table-cell border="solid black 1px" padding="2px"><fo:block>Autor</fo:block></fo:table-cell>
<fo:table-cell border="solid black 1px" padding="2px"><fo:block>Tipo</fo:block></fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:apply-templates select="biblioteca"/>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="libro">
<fo:table-row>
<xsl:apply-templates/>
</fo:table-row>
</xsl:template>
<xsl:template match="titulo">
<fo:table-cell border="solid black 1px" padding="2px">
<fo:block><xsl:value-of select="."/></fo:block>
</fo:table-cell>
</xsl:template>
<xsl:template match="autor">
<fo:table-cell border="solid black 1px" padding="2px">
<fo:block><xsl:value-of select="."/></fo:block>
</fo:table-cell>
</xsl:template>
<xsl:template match="@tipo">
<fo:table-cell border="solid black 1px" padding="2px">
<fo:block><xsl:value-of select="."/></fo:block>
</fo:table-cell>
</xsl:template>
</xsl:stylesheet>
My question is how can I access the 'type' attribute of the 'book' node since almost any xpath that I place returns empty or thunders?