Subject: Re: [xsl] XSL-FO & Selecting Attributes From: "craig webber" <craigwebber@xxxxxxxxxxx> Date: Wed, 20 Apr 2005 15:42:30 +0000 |
From: omprakash.v@xxxxxxxxxxxxx Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] XSL-FO & Selecting Attributes Date: Wed, 20 Apr 2005 20:51:18 +0530
I believe you have misunderstood him. the xpath expression "Item/*" represents the child nodes of Item. So if you have one template named
that would be enough to process all item child nodes like name, description etc.
<xsl:template match="Item/*"> <fo:block> <xsl:value-of select="."/> </fo:block> </xsl:template>
If you need the value of Sector as well, then you need a template for Item itself as follows:
<xsl:template match="Item"> <xsl:value-of select="@Sector"/> </xsl:template>
<xsl:template match="Item/image"> <fo:block> <fo:external-graphic src='url("{.}")'/> </fo:block> </xsl:template>
Cheers, Omprakash.V
Your solution does not seem to working. As far as I can make out you are suggetsing the following approach:
<xsl:template match="Item/*"> <fo:block> <xsl:value-of select="@Sector"/> </fo:block> </xsl:template>
<xsl:template match="Item/*"> <fo:block> <xsl:value-of select="name"/> </fo:block> </xsl:template>
<xsl:template match="Item/*"> <fo:block> <xsl:value-of select="description"/> </fo:block> </xsl:template>
<xsl:template match="Item/*"> <fo:block> <xsl:value-of select="publishDate"/> </fo:block> </xsl:template>
<xsl:template match="Item/*"> <fo:block> <xsl:value-of select="closingDate"/> </fo:block> </xsl:template>
<xsl:template match="Item/*"> <fo:block> <xsl:value-of select="urnNumber"/> </fo:block> </xsl:template>
<xsl:template match="Item/image"> <fo:block> <fo:external-graphic src='url("{.}")'/> </fo:block> </xsl:template>
<fo:page-sequence master-reference="page1"> <fo:flow flow-name="xsl-region-body"> <xsl:apply-templates select="publications/Item"/> </fo:flow> </fo:page-sequence>
<header> <heading>Paragraph Header</heading> <para1>Para 1 text</para1> <para2>Para 2 text</para2> </header>
<Item Sector="Agriculture" response="no"> <name>Poor Farmers Relief Fund</name> <description>A Consultation on ...</description> <publishDate>05.01.04</publishDate> <closingDate>20.02.04</closingDate> <urnNumber>04/1245</urnNumber> <image>image.jpg</image> </Item>
Agriculture Poor Farmers Relief Fund A Consultation on .. 05.01.04 20.02.04 04/1245 image
_________________________________________________________________ Find a date, consult a directory and win prizes - only on MSN South Africa!
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL-FO & Selecting Attrib, omprakash . v | Thread | Re: [xsl] XSL-FO & Selecting Attrib, Jon Gorman |
Re: [xsl] XSL-FO & Selecting Attrib, craig webber | Date | Re: [xsl] XSL-FO & Selecting Attrib, omprakash . v |
Month |