xsl-list
[Top] [All Lists]

Re: XSL-FO & Selecting Attributes

2005-04-20 08:25:00


Hi,

Just use the following for your item template. I believe this was your
original problem.

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

Note the addition of <xsl:apply-templates/> above.

Cheers,
Omprakash.V




                                                                                
                                     
                    omprakash(_dot_)v(_at_)pol                                  
                                                
                    aris.co.in             To:     
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com                                
   
                                           cc:     (bcc: omprakash.v/Polaris)   
                                     
                    04/20/2005             Subject:     Re: [xsl] XSL-FO & 
Selecting Attributes                      
                    08:51 PM                                                    
                                     
                    Please respond                                              
                                     
                    to xsl-list                                                 
                                     
                                                                                
                                     
                                                                                
                                     






Hi,

        I believe you have misunderstood him. the xpath expression "Item/*"
represents the child nodes of Item. So if you have one template named

<xsl:template match="Item/*">

that would be enough to process all item child nodes like name, description
etc.

You can then do something like

<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>

And for those child nodes which need different treatment like image, you do

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



Hope this helps.

Cheers,
Omprakash.V









                    "craig webber"

                    <craigwebber(_at_)ho        To:
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
                    tmail.com>             cc:     (bcc:
omprakash.v/Polaris)
                                           Subject:     Re: [xsl] XSL-FO &
Selecting Attributes
                    04/20/2005

                    07:51 PM

                    Please respond

                    to xsl-list







Thanks David,

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>

My "page-sequence" is as follows:

<fo:page-sequence master-reference="page1">
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates select="publications/Item"/>
</fo:flow>
</fo:page-sequence>

Here's my XML document:

<publications>

<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>

</publications>

The result is a transforamation of the image only. The result should be:

Agriculture
Poor Farmers Relief Fund
A Consultation on ..
05.01.04
20.02.04
04/1245
image

Thanks, Craig Webber.

_________________________________________________________________
Find a date, consult a directory and win prizes - only on MSN South Africa!

http://www.msn.co.za/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--






This e-Mail may contain proprietary and confidential information and is
sent for the intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected to
you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction,
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its
attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--






This e-Mail may contain proprietary and confidential information and is sent 
for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to 
you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its 
attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>