You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Diana <fu...@o2.pl> on 2006/11/11 14:20:25 UTC

make code XSL FO - help me

Hi. 

This in my file XML: 

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="pracownik.xsl"?>
<workers>
 <worker id="prac1">
   <date_name>
        <name>Anna</name>
      <surname>Zimek</surname>
      <pesel> 11223344556 </pesel>
      <date> 23.01.1983 </date>
    </date_name>
  <position> kierownik </position>
  <phone> 600400500 </phone>
  <adres> 
    <street>Wintera</street>
   <no>8</no>
   <city>Cieszyn</city>
  </adres>
  <stan> panna </stan>
  <children> nie </children>
  <school> srednie </school>
    
     <foto typ="gif" nazwa="obraz.gif" width="150" height="160" />
  
   
   </worker>
   
    </workers>


I have big problem. I have to make table consist of two cell :
first must include photo of employee and the other must inculde rest dates of XML: 

All should look like this : 


=================================
||                            || ||    Name & surname   || 
||        Fhoto            || ||    Adres:                  || 
||                            || ||    City, Street No      || 
||                            || ||    Phone:                 || 
||                            || ||    Children:               || 
||                            || ||                               || 
||                            || ||                               || 
===============================

Space 

=================================
||                            || ||    Name & surname   || 
||        Fhoto            || ||    Adres:                  || 
||                            || ||    City, Street No      || 
||                            || ||    Phone:                 || 
||                            || ||    Children:               || 
||                            || ||                               || 
||                            || ||                               || 
===============================

Space 

=================================
||                            || ||    Name & surname   || 
||        Fhoto            || ||    Adres:                  || 
||                            || ||    City, Street No      || 
||                            || ||    Phone:                 || 
||                            || ||    Children:               || 
||                            || ||                               || 
||                            || ||                               || 
===============================



Please, help me , I was trying all night and I can't prepare this :-((
Thank you so much. 

Diana. 

Re: make code XSL FO - help me

Posted by Szymon Bochniak <sz...@javart.com.pl>.
Hi Diana,
i would do it more or less like this:
unfortunately i had no possibility to check if it works fine (but should 
for me). There is a nice xsl-fo docs reference at 
http://xmlgraphics.apache.org/fop/compliance.html.
don't hesitate to ask if u had any questions. powodzenia ;)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:fo="http://www.w3.org/1999/XSL/Format"
        version="1.0">



<xsl:template match="//workers">

    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

        <fo:layout-master-set>

            <fo:simple-page-master master-name="wniosek"
                    margin-top="5mm" margin-bottom="5mm"
                    margin-left="5mm" margin-right="5mm">
                <fo:region-body margin-top="5mm" margin-bottom="5mm" />
            </fo:simple-page-master>

        </fo:layout-master-set>
  

        <fo:page-sequence master-reference="wniosek" format="1" 
language="pl">
           
            <fo:flow flow-name="xsl-region-body">
            <xsl:for-each select="./worker"><fo:block padding-after="15mm">
            <fo:table width="150mm">
               
                <fo:table-column 
column-width="50%"></fo:table-column><fo:table-column 
column-width="50%"></fo:table-column><fo:table-body><fo:table-row>
    <fo:table-cell column-number="1">
        <fo:block>
            <fo:external-graphics>
                <xsl:attribute name="src">
                    <xsl:value-of 
select="./foto/@nazwa"></xsl:value-of></xsl:attribute><xsl:attribute 
name="width">
                    <xsl:value-of 
select="./foto/@width"></xsl:value-of>px</xsl:attribute><xsl:attribute 
name="height">
                    <xsl:value-of 
select="./foto/@height"></xsl:value-of>px</xsl:attribute></fo:external-graphics></fo:block></fo:table-cell>
    <fo:table-cell column-number="2">
        <fo:block>
            <xsl:value-of 
select="./date_name/name"></xsl:value-of><xsl:text>&#x020;</xsl:text><xsl:value-of 
select="./date_name/surname"></xsl:value-of>
            </fo:block><fo:block><xsl:text>Adres:</xsl:text>
            </fo:block><fo:block>
            <xsl:value-of 
select="./adres/city"></xsl:value-of><xsl:text>,&#x020;</xsl:text><xsl:value-of 
select="./adres/street"></xsl:value-of><xsl:text>&#x020;</xsl:text><xsl:value-of 
select="./adres/no"></xsl:value-of>
            
</fo:block><fo:block><xsl:text>Phone:&#x020;</xsl:text><xsl:value-of 
select="./phone"></xsl:value-of>
            
</fo:block><fo:block><xsl:text>Children:&#x020;</xsl:text><xsl:value-of 
select="./children"></xsl:value-of>
            </fo:block></fo:table-cell></fo:table-row></fo:table-body>
                </fo:table></fo:block></xsl:for-each></fo:flow>
       
   
        </fo:page-sequence>
    </fo:root>

</xsl:template>
   

</xsl:stylesheet>




Diana wrote:
> Hi.
>  
> This in my file XML:
>  
> <?xml version="1.0"?>
> <?xml-stylesheet type="text/xsl" href="pracownik.xsl"?>
> <workers>
>  <worker id="prac1">
>    <date_name>
>         <name>Anna</name>
>       <surname>Zimek</surname>
>       <pesel> 11223344556 </pesel>
>       <date> 23.01.1983 </date>
>     </date_name>
>   <position> kierownik </position>
>   <phone> 600400500 </phone>
>   <adres>
>     <street>Wintera</street>
>    <no>8</no>
>    <city>Cieszyn</city>
>   </adres>
>   <stan> panna </stan>
>   <children> nie </children>
>   <school> srednie </school>
>    
>      <foto typ="gif" nazwa="obraz.gif" width="150" height="160" />
>   
>   
>    </worker>
>    
>     </workers>
>  
>
> I have big problem. I have to make table consist of two cell :
> first must include photo of employee and the other must inculde rest 
> dates of XML:
>  
> All should look like this :
>  
>  
> =================================
> ||                            || ||    Name & surname   ||
> ||        Fhoto            || ||    Adres:                  ||
> ||                            || ||    City, Street No      ||
> ||                            || ||    Phone:                 ||
> ||                            || ||    Children:               ||
> ||                            || ||                               ||
> ||                            || ||                               ||
> ===============================
>  
> Space
>  
> =================================
> ||                            || ||    Name & surname   ||
> ||        Fhoto            || ||    Adres:                  ||
> ||                            || ||    City, Street No      ||
> ||                            || ||    Phone:                 ||
> ||                            || ||    Children:               ||
> ||                            || ||                               ||
> ||                            || ||                               ||
> ===============================
> Space
>  
> =================================
> ||                            || ||    Name & surname   ||
> ||        Fhoto            || ||    Adres:                  ||
> ||                            || ||    City, Street No      ||
> ||                            || ||    Phone:                 ||
> ||                            || ||    Children:               ||
> ||                            || ||                               ||
> ||                            || ||                               ||
> ===============================
>
>
> Please, help me , I was trying all night and I can't prepare this :-((
> Thank you so much.
>  
> Diana.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org