Altova Mailing List Archives


Re: [xsl] XSL-FO & Selecting Attributes

From: Jon Gorman <jonathan.gorman@--------->
To:
Date: 4/20/2005 4:03:00 PM
I believe that Omprakash code looks valid.  It shouldn't have caused
an error.  Perhaps you can share the error message?

To clarify things a bit, I believe David made a mistake in copying and
pasting...I think what he intended to point out was that if you do:

<xsl:template match="Item/*">
<fo:block>
<xsl:value-of select="."/>
</fo:block>
</xsl:template>

You will have that template applied to all the children of Item
instead of having to do
<xsl:template match="Item/name">
<fo:block>
<xsl:value-of select="."/>
</fo:block>
</xsl:template>

<xsl:template match="Item/description">
<fo:block>
<xsl:value-of select="."/>
</fo:block>
</xsl:template>

and so on.

As both David and Omprakash point out, you need that <apply-templates
/> because otherwise it will do no further processing down the tree.
So the more compact templates should like like:

<xsl:template match="Item">
<fo:block>
<xsl:value-of select="@Sector"/>
<xsl:apply-templates />
</fo:block>
</xsl:template>

<xsl:template match="Item/*">
<fo:block>
<xsl:value-of select="."/>
</fo:block>
</xsl:template>

and you might want to do something like David recommends and add:

<xsl:template match="Item/image">
<fo:block>
<fo:external-graphic src="url({.})"/>
</fo:block>
</xsl:template>



And for me produces (didn't use the image template because I'm not
sure what you want to do there) this output:

<fo:block>Agriculture
<fo:block>Poor Farmers Relief Fund</fo:block>
<fo:block>A Consultation on ...</fo:block>
<fo:block>05.01.04</fo:block>
<fo:block>20.02.04</fo:block>
<fo:block>04/1245</fo:block>
<fo:block>image.jpg</fo:block>
</fo:block>

Had I added the image template it would have placed the image in the
document.

Jon Gorman


ps.  I'm not sure that I understand your comment from the original post:
>  Does not seem to work the same wasy as in my XSLT
transformation.

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.