Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1009973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:00:38+00:00 2026-05-16T09:00:38+00:00

I’ve been trying to transform my XML documents to PDF through Apache FOP, but

  • 0

I’ve been trying to transform my XML documents to PDF through Apache FOP,
but the output pdf is blank.

Any help to why this is occuring is greatly appreciated.

The code seems to be executed without errors:

C:\Users\dfh\Desktop\fop-0.20.5>fop -xml DICENTIA_SDC_SN_1_224860.xml -xsl testx
sl.xsl -pdf test2.pdf
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] FOP 0.20.5
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[INFO] Parsing of document complete, stopping renderer

XSL file (testxsl):

<?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="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simple" 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="simple">
<fo:flow flow-name="xsl-region-body">
  <xsl:apply-templates select="SDC_SN_1/General" /> 
  </fo:flow>
  </fo:page-sequence>
  </fo:root>
  </xsl:template>
<xsl:template match="SDC_SN_1/General">
<fo:block>
  <xsl:apply-templates select="Document_No" />  
  </fo:block>
  </xsl:template>
<xsl:template match="SDC_SN_1/General/Document_No">
<fo:block font-size="12pt" font-family="sans-serif" line-height="15pt" space-after.optimum="3pt" text-align="justify">
  <xsl:value-of select="SDC_SN_1/General/Document_No" /> 
  </fo:block>
  </xsl:template>
  </xsl:stylesheet> 

The XML-file:

    <?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="../xsl/SN_1.xsl" ?>
<SDC_SN_1>
    <General>
        <Our_Mail_Address></Our_Mail_Address>
        <Document_Number>850</Document_Number>
        <Sell_to_Customer Number="815">
            <Name></Name>
            <Additional_Name_Info></Additional_Name_Info>
            <Address></Address>
            <Additional_Address_Info></Additional_Address_Info>
            <City>Valby</City>
            <Contact_Person></Contact_Person>
            <Post_Code>2500</Post_Code>
            <County></County>
            <Country_Code>Danmark</Country_Code>
        </Sell_to_Customer>
        <Requisition>DOWNTOWN</Requisition>
        <Your_Reference>kristina</Your_Reference>
        <Our_Reference></Our_Reference>
        <Order_Date></Order_Date>
        <Document_Creation_Date>30/07-2010</Document_Creation_Date>
        <Salesperson>INT</Salesperson>
        <Order_Number></Order_Number>
        <Job_Number></Job_Number>
        <VAT_Registration_Number></VAT_Registration_Number>
        <INTRASTAT_Transaction_Type></INTRASTAT_Transaction_Type>
        <INTRASTAT_Transport_Method></INTRASTAT_Transport_Method>
        <Exit_Point></Exit_Point>
        <External_Document_Number></External_Document_Number>
        <Posting_Date></Posting_Date>
        <EU_Third_Party_Trade></EU_Third_Party_Trade>
        <Customer_Order_Number></Customer_Order_Number>
        <Customer_Order_Number2></Customer_Order_Number2>
    </General>
    <Invoicing>
        <Bill_to_Customer Number="">
            <Name></Name>
            <Additional_Name_Info></Additional_Name_Info>
            <Address></Address>
            <Additional_Address_Info></Additional_Address_Info>
            <City>Valby</City>
            <Contact_Person></Contact_Person>
            <Post_Code>2500</Post_Code>
            <County></County>
            <Country_Code>Danmark</Country_Code>
        </Bill_to_Customer>
        <Department></Department>
        <Project></Project>
    </Invoicing>
    <Shipping>
        <Ship_to_Customer>
            <Code></Code>
            <Name></Name>
            <Additional_Name_Info></Additional_Name_Info>
            <Address></Address>
            <Additional_Address_Info></Additional_Address_Info>
            <City>Haslev</City>
            <Contact_Person></Contact_Person>
            <Post_Code>4690</Post_Code>
            <County></County>
            <Country_Code>Danmark</Country_Code>
        </Ship_to_Customer>
        <Shipment_Date>30/07-2010</Shipment_Date>
        <Shipment_Date_Receive>02/08-2010</Shipment_Date_Receive>
        <Shipment_Time_Receive></Shipment_Time_Receive>
        <Shipment_Method></Shipment_Method>
        <Shipment_Condition>Freight, Carriage paid to</Shipment_Condition>
        <Location_in_Inventory></Location_in_Inventory>
        <Shipping_Agent></Shipping_Agent>
        <Package_Tracking_Number></Package_Tracking_Number>
        <Currency></Currency>
        <Shipment_From_Time></Shipment_From_Time>
        <Shipment_To_Time></Shipment_To_Time>
        <Shipment_Colli></Shipment_Colli>
        <Shipment_Net_Weight></Shipment_Net_Weight>
        <Shipment_Gross_Weight></Shipment_Gross_Weight>
    </Shipping>
    <Company_Info>
        <Company_Name></Company_Name>
        <Company_Additional_Name_Info></Company_Additional_Name_Info>
        <Company_Address></Company_Address>
        <Company_Address_Additional_Address_Info></Company_Address_Additional_Address_Info>
        <Company_City></Company_City>
        <Company_Phone_Number></Company_Phone_Number>
        <Company_Additional_Phone_Number></Company_Additional_Phone_Number>
        <Company_Telex_Number></Company_Telex_Number>
        <Company_Fax_Number></Company_Fax_Number>
        <Company_Giro_Number></Company_Giro_Number>
        <Company_Bank_Name></Company_Bank_Name>
        <Company_Bank_Branch_Number></Company_Bank_Branch_Number>
        <Company_Bank_Account_Number></Company_Bank_Account_Number>
        <Company_Payment_Routing_Number></Company_Payment_Routing_Number>
        <Company_VAT_Registration_Number></Company_VAT_Registration_Number>
        <Company_Registration_Number></Company_Registration_Number>
        <Company_Location_in_Inventory></Company_Location_in_Inventory>
        <Company_Post_Code></Company_Post_Code>
        <Company_County></Company_County>
        <Company_E_Mail></Company_E_Mail>
        <Company_Home_Page></Company_Home_Page>
    </Company_Info>
    <Line Line_Type="item">
        <Number></Number>
        <Catalog_Number></Catalog_Number>
        <Location_in_Inventory></Location_in_Inventory>
        <Shipment_Date></Shipment_Date>
        <Description></Description>
        <Additional_Description></Additional_Description>
        <Unit_of_Measure></Unit_of_Measure>
        <Ordered></Ordered>
        <Quantity></Quantity>
        <Back></Back>
        <Item_Gross_Weight></Item_Gross_Weight>
        <Item_Net_Weight></Item_Net_Weight>
        <Units_per_Parcel></Units_per_Parcel>
        <Unit_Volume></Unit_Volume>
        <Department></Department>
        <Project></Project>
        <Job_Number></Job_Number>
        <Item_Serial_Number></Item_Serial_Number>
        <Order_Number></Order_Number>
        <Order_Line_Number></Order_Line_Number>
        <INTRASTAT_Transaction_Type></INTRASTAT_Transaction_Type>
        <INTRASTAT_Transport_Method></INTRASTAT_Transport_Method>
        <Exit_Point></Exit_Point>
        <INTRASTAT_Area></INTRASTAT_Area>
        <Lot_Number></Lot_Number>
        <Item_Variant></Item_Variant>
        <Bin_Code></Bin_Code>
        <Unit_of_Measure_Code></Unit_of_Measure_Code>
        <Common_Item_Number></Common_Item_Number>
        <Customer_Item_Number></Customer_Item_Number>
        <Line_Note>
            <Note_Line></Note_Line>
        </Line_Note>
    </Line>
    </SDC_SN_1>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T09:00:39+00:00Added an answer on May 16, 2026 at 9:00 am

    The main reason you’re still getting a blank PDF is because your other templates are never getting applied. I made a couple of changes to your stylesheet (such as adding an identity transform, changing the select‘s, removing an unnecessary template and fixing the spelling of Document_Number) and I’m getting output on the PDF.

    Modified version of your XSL:

    <?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:output indent="yes"/>
    
      <xsl:template match="node()|@*">
        <xsl:apply-templates select="node()|@*"/>
      </xsl:template>
    
      <xsl:template match="SDC_SN_1">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
          <fo:layout-master-set>
            <fo:simple-page-master master-name="simple" 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="simple">
            <fo:flow flow-name="xsl-region-body">
              <xsl:apply-templates select="General/Document_Number"/>
            </fo:flow>
          </fo:page-sequence>
        </fo:root>
      </xsl:template>
    
      <xsl:template match="Document_Number">
        <fo:block font-size="12pt" font-family="sans-serif" line-height="15pt" space-after.optimum="3pt" text-align="justify">
          <xsl:value-of select="."/>
        </fo:block>
      </xsl:template>
    
    </xsl:stylesheet>
    

    I also wrote a quick stylesheet that creates the “General” section and part of the “Shipping” section (based on your HTML output that was originally in the question). It uses a slightly different approach though.

    My XSL:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <xsl:output indent="yes"/>
      <xsl:strip-space elements="*"/>
    
      <xsl:template match="node()|@*">
        <xsl:apply-templates select="node()|@*"/>
      </xsl:template>
    
      <xsl:template match="SDC_SN_1">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
          <fo:layout-master-set>
            <fo:simple-page-master master-name="my-page" page-width="8.5in" page-height="11in">
              <fo:region-body margin="1in" margin-top="1.5in"/>
            </fo:simple-page-master>
          </fo:layout-master-set>
          <fo:page-sequence master-reference="my-page">
            <fo:flow flow-name="xsl-region-body">
              <xsl:apply-templates/>
            </fo:flow>
          </fo:page-sequence>
        </fo:root>
      </xsl:template>
    
      <xsl:template match="General">
        <fo:block font-weight="bold" text-decoration="underline" margin-top=".25in">General</fo:block>
        <fo:table margin-top=".25in" margin-bottom=".25in">
          <!-- border-style="solid" border-width="1pt" -->
          <fo:table-column column-width="25%"/>
          <fo:table-column column-width="75%"/>
          <fo:table-body>
            <fo:table-row>
              <xsl:apply-templates select="Document_Number"/>
            </fo:table-row>
            <fo:table-row>
              <xsl:apply-templates select="Order_Number"/>
            </fo:table-row>
            <fo:table-row>
              <xsl:apply-templates select="Sell_to_Customer/Name"/>
            </fo:table-row>
            <fo:table-row>
              <xsl:apply-templates select="Customer_Order_Number"/>
            </fo:table-row>
            <fo:table-row>
              <xsl:apply-templates select="Customer_Order_Number2"/>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </xsl:template>
    
      <xsl:template match="General/Document_Number">
        <fo:table-cell>
          <fo:block>Document Number</fo:block>
        </fo:table-cell>
        <fo:table-cell>
          <fo:block>: <xsl:value-of select="."/></fo:block>
        </fo:table-cell>
      </xsl:template>
    
      <xsl:template match="General/Order_Number">
        <fo:table-cell>
          <fo:block>Order Number</fo:block>
        </fo:table-cell>
        <fo:table-cell>
          <fo:block>: <xsl:value-of select="."/></fo:block>
        </fo:table-cell>
      </xsl:template>
    
      <xsl:template match="Sell_to_Customer/Name">
        <fo:table-cell>
          <fo:block>Name</fo:block>
        </fo:table-cell>
        <fo:table-cell>
          <fo:block>: <xsl:value-of select="."/></fo:block>
        </fo:table-cell>
      </xsl:template>
    
      <xsl:template match="General/Customer_Order_Number">
        <fo:table-cell>
          <fo:block>Customer Reference</fo:block>
        </fo:table-cell>
        <fo:table-cell>
          <fo:block>: <xsl:value-of select="."/></fo:block>
        </fo:table-cell>
      </xsl:template>
    
      <xsl:template match="General/Customer_Order_Number2">
        <fo:table-cell>
          <fo:block>Purchase Order</fo:block>
        </fo:table-cell>
        <fo:table-cell>
          <fo:block>: <xsl:value-of select="."/></fo:block>
        </fo:table-cell>
      </xsl:template>
    
      <xsl:template match="Shipping">
        <fo:block font-weight="bold" text-decoration="underline" margin-top=".25in">Shipping</fo:block>
        <fo:table margin-top=".25in" margin-bottom=".25in">
          <!-- border-style="solid" border-width="1pt" -->
          <fo:table-column column-width="25%"/>
          <fo:table-column column-width="75%"/>
          <fo:table-body>
            <fo:table-row>
              <xsl:apply-templates select="Ship_to_Customer/Name"/>
            </fo:table-row>
            <fo:table-row>
              <xsl:apply-templates select="Ship_to_Customer/Additional_Name_Info"/>
            </fo:table-row>
            <fo:table-row>
              <xsl:apply-templates select="Ship_to_Customer/Contact_Person"/>
            </fo:table-row>
            <fo:table-row>
              <xsl:apply-templates select="Ship_to_Customer/Address"/>
            </fo:table-row>
            <fo:table-row>
              <xsl:apply-templates select="Ship_to_Customer/Additional_Address_Info"/>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </xsl:template>
    
      <xsl:template match="Ship_to_Customer/Name">
        <fo:table-cell>
          <fo:block>Name</fo:block>
        </fo:table-cell>
        <fo:table-cell>
          <fo:block>: <xsl:value-of select="."/></fo:block>
        </fo:table-cell>    
      </xsl:template>
    
      <xsl:template match="Ship_to_Customer/Additional_Name_Info">
        <fo:table-cell>
          <fo:block>Name 2</fo:block>
        </fo:table-cell>
        <fo:table-cell>
          <fo:block>: <xsl:value-of select="."/></fo:block>
        </fo:table-cell>    
      </xsl:template>
    
      <xsl:template match="Ship_to_Customer/Contact_Person">
        <fo:table-cell>
          <fo:block>Contact</fo:block>
        </fo:table-cell>
        <fo:table-cell>
          <fo:block>: <xsl:value-of select="."/></fo:block>
        </fo:table-cell>    
      </xsl:template>
    
      <xsl:template match="Ship_to_Customer/Address">
        <fo:table-cell>
          <fo:block>Address</fo:block>
        </fo:table-cell>
        <fo:table-cell>
          <fo:block>: <xsl:value-of select="."/></fo:block>
        </fo:table-cell>    
      </xsl:template>
    
      <xsl:template match="Ship_to_Customer/Additional_Address_Info">
        <fo:table-cell>
          <fo:block>Address 2</fo:block>
        </fo:table-cell>
        <fo:table-cell>
          <fo:block>: <xsl:value-of select="."/></fo:block>
        </fo:table-cell>    
      </xsl:template>
    
    </xsl:stylesheet>
    

    Let me know if you need any other help with your stylesheet or if you have questions about mine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.