Question

Problem with XSL stylesheet

Asked by: gobicse

hi there
  i have a xsl stylesheet .. i use it to convert html to pdf using FOP... everytime i compile my program it says an error in my xsl stylesheet like

"[Fatal Error] 1.xsl:829:48: Element type "xsl:template" must be followed by either attribute specifications, ">" or "/>".
org.xml.sax.SAXParseException: Element type "xsl:template" must be followed by either attribute specifications, ">" or "/>".
      at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
      at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
      at fop.Html2PdfFOP.getTransformer(Html2PdfFOP.java:123)
      at fop.Html2PdfFOP.fo2PDF(Html2PdfFOP.java:101)
      at fop.Html2PdfFOP.main(Html2PdfFOP.java:74)"

 it says the error is the double quotes inside the " q|q[starts-with(.,' " ') " in my xsl stylesheet...

<xsl:template match="xhtml:q|q[starts-with(.,'"') or starts-with(.,'') or starts-with(.,'?')]">

when i try to remove the double quotes and compile it.. it gives the following error.. can anyone help me out....

(Location of error unknown)org.xml.sax.SAXException: Can not resolve namespace prefix: xhtml
(Location of error unknown)org.xml.sax.SAXException: Can not resolve namespace prefix: xhtml

<xsl:template match="xhtml:q|q[starts-with(.,'"') or starts-with(.,'') or starts-with(.,'?')]">
-
<fo:inline>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-

                                  
1:
2:
3:
4:
5:
6:
7:
8:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-08-23 at 04:23:51ID24674526
Tags

XML

,

XSL

Topics

XSL Formatting Objects

,

Extensible Stylesheet Language Transformation (XSLT)

,

Extensible HTML (XHTML)

Participating Experts
2
Points
500
Comments
46

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. XSL transformation of XHTML to XHTML, namespace problem
    Hi, I'm having a problem with namespaces in XHTML... With this XHTML document: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <ht...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: GertonePosted on 2009-08-23 at 05:53:01ID: 25162425

make a variable
    <xsl:variable name="quot">&quot;</xsl:variable>

and change the test like this
starts-with(.,$quot)

 

by: abelPosted on 2009-08-23 at 06:05:27ID: 25162460

That will help only if this is an XSLT 2.0 stylesheet. In XSLT 1.0, it is not allowed. But considering running it under Saxon, I assume the Asker made his stylesheet in XSLT 2.0?

 

by: GertonePosted on 2009-08-23 at 06:13:44ID: 25162479

Aha, off course, I overlooked the fact that the predicate is in a template/@match, sorry about that.
Next step to do is move this to a choose construct inside the body of the template, if this would be XSLT1

 

by: gobicsePosted on 2009-08-23 at 18:48:43ID: 25165180

hi there..

 actually i took the stylesheet from the following link... i dont have any idea whether its XSLT 1 or 2... i need help guys...

http://webcoder.info/downloads/xhtml2fo.html

 

by: gobicsePosted on 2009-08-23 at 18:50:01ID: 25165188

hey guys

  its XSLT 1.0 version....

 

by: gobicsePosted on 2009-08-23 at 18:57:10ID: 25165215

hi gertone

 can you tell me how to move this inside the body of the template.. i have only lil bit knowledge in it and i am just learning this now...

 

by: GertonePosted on 2009-08-24 at 01:09:10ID: 25166327

Taken from the original stylesheet,
I made the change as I think you need it

<xsl:template match="xhtml:q|q">
  <xsl:if test="starts-with(., $quot)">
    <fo:inline><xsl:call-template name="common-atts"/>
      <xsl:text disable-output-escaping="yes">&amp;#x201C;</xsl:text>
      <xsl:apply-templates/>
      <xsl:text disable-output-escaping="yes">&amp;#x201D;</xsl:text>
    </fo:inline>
  </xsl:if>
</xsl:template>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:

Select allOpen in new window

 

by: abelPosted on 2009-08-24 at 01:49:23ID: 25166506

>  its XSLT 1.0 version....

note that you can do XSLT 2.0, after all you are using Saxon, which supports that natively. If you are planning on doing more XSLT, the 2.0 version is a lot easier to deal with, and results in less and more readable code :)

 

by: gobicsePosted on 2009-08-24 at 14:46:21ID: 25172962

hi gertone

  i tried your solution.. but i ve got the following error.. i replaced your code with the older one in the xsl stylesheet..

(Location of error unknown)org.xml.sax.SAXException: Can not resolve namespace prefix: xhtml
(Location of error unknown)org.xml.sax.SAXException: Can not resolve namespace prefix: xhtml
java.lang.NullPointerException
      at java.io.FileOutputStream.write(Unknown Source)
      at fop.Html2PdfFOP.main(Html2PdfFOP.java:74)

 

by: abelPosted on 2009-08-24 at 14:53:20ID: 25173017

You need to add the namespace for xhtml to the top of your stylesheet:

xmlns:xhtml="http://www.w3.org/1999/xhtml"

 

by: gobicsePosted on 2009-08-24 at 18:16:34ID: 25173934

hi abel and gertone..

  thanks for your replies... now i ve got another problem... no other errors except like

" C:\Users\gobicse\workspace\FOP\dummy.xsl; Line #0; Column #0; Non-whitespace text is not allowed in this position in the stylesheet! "

was coming.. say around 40 lines of same message again and again... and also there is no dummy.xsl file in the path which is shown above... the xsl file which i am using is in the desktop(which i named it as 1.xsl)...then why it is showing a file like this...

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xsl:output method="xml" version="1.0" standalone="yes" omit-xml-declaration="yes" encoding="utf-8" media-type="text/xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:preserve-space elements="xhtml:listing listing xhtml:plaintext plaintext xhtml:pre pre xhtml:samp samp"/>
<xsl:param name="font-size" select="''"/>
<xsl:param name="font.symbol" select="'Arial Unicode MS'"/>
-
<xsl:template name="common-atts">
<xsl:copy-of select="@id|@color|@height|@width|@xml:lang"/>
-
<xsl:if test="@align">
-
<xsl:attribute name="text-align">
<xsl:value-of select="@align"/>
</xsl:attribute>
</xsl:if>
-
<xsl:if test="@nowrap">
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
</xsl:if>
</xsl:template>
-
<xsl:template match="xhtml:html|html">
-
<fo:root>
-
<fo:layout-master-set>
-
<fo:simple-page-master master-name="page">
<fo:region-body margin=".75in .75in .75in .75in"/>
<fo:region-before extent=".5in"/>
<fo:region-after extent=".5in"/>
</fo:simple-page-master>
</fo:layout-master-set>
-
<fo:page-sequence master-reference="page">
-
<fo:static-content flow-name="xsl-region-before">
-
<fo:block display-align="after" padding-before=".2in" text-align="center" font-size="9pt">
<xsl:apply-templates select="xhtml:head/xhtml:title|head/title"/>
</fo:block>
</fo:static-content>
-
<fo:static-content flow-name="xsl-region-after">
-
<fo:block display-align="before" text-align="center" font-size="8pt">
<xsl:text>page </xsl:text>
<fo:page-number/>
<xsl:text> of </xsl:text>
<fo:page-number-citation ref-id="__END__"/>
</fo:block>
</fo:static-content>
<xsl:apply-templates/>
</fo:page-sequence>
</fo:root>
</xsl:template>
-
<xsl:template match="xhtml:title|title">
-
<fo:block>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:basefont|basefont">
<xsl:copy-of select="@color"/>
-
<xsl:choose>
-
<xsl:when test="@size=1">
<xsl:attribute name="font-size">xx-small</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=2">
<xsl:attribute name="font-size">x-small</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=3">
<xsl:attribute name="font-size">small</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=4">
<xsl:attribute name="font-size">medium</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=5">
<xsl:attribute name="font-size">large</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=6">
<xsl:attribute name="font-size">x-large</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=7">
<xsl:attribute name="font-size">xx-large</xsl:attribute>
</xsl:when>
</xsl:choose>
-
<xsl:if test="@face">
-
<xsl:attribute name="font-family">
<xsl:value-of select="@face"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
-
<xsl:template match="xhtml:body|body">
-
<fo:flow flow-name="xsl-region-body">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates select="//basefont[1]"/>
-
<xsl:if test="$font-size">
-
<xsl:attribute name="font-size">
<xsl:value-of select="$font-size"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
<fo:block id="__END__"/>
</fo:flow>
</xsl:template>
<xsl:template match="xhtml:head|head|xhtml:applet|applet|xhtml:area|area|xhtml:base|base   |xhtml:bgsound|bgsound|xhtml:embed|embed|xhtml:frame|frame|xhtml:frameset|frameset|xhtml:iframe|iframe   |xhtml:ilayer|ilayer|xhtml:layer|layer|xhtml:input[@type='hidden']|input[@type='hidden']   |xhtml:isindex|isindex|xhtml:link|link|xhtml:map|map|xhtml:meta|meta|xhtml:object|object|xhtml:param|param   |xhtml:ruby|ruby|xhtml:rt|rt|xhtml:script|script|xhtml:spacer|spacer|xhtml:style|style|xhtml:wbr|wbr   |xhtml:xml|xml|xhtml:xmp|xmp"/>
-
<xsl:template match="comment">
-
<xsl:comment>
<xsl:apply-templates/>
</xsl:comment>
</xsl:template>
-
<xsl:template match="processing-instruction()">
<xsl:copy-of select="."/>
</xsl:template>
<!-- Links and Media -->
-
<xsl:template match="xhtml:a|a">
-
<fo:inline>
<xsl:call-template name="common-atts"/>
-
<xsl:if test="@name and not(@id)">
-
<xsl:attribute name="id">
<xsl:value-of select="@name"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:a[@href]|a[@href]">
-
<fo:basic-link color="blue" text-decoration="underline">
-
<xsl:if test="@type">
-
<xsl:attribute name="content-type">
<xsl:value-of select="@type"/>
</xsl:attribute>
</xsl:if>
-
<xsl:choose>
-
<xsl:when test="starts-with(@href,'#')">
-
<xsl:attribute name="internal-destination">
<xsl:value-of select="substring-after(@href,'#')"/>
</xsl:attribute>
</xsl:when>
-
<xsl:otherwise>
-
<xsl:attribute name="external-destination">
<xsl:text>url('</xsl:text>
<xsl:value-of select="concat(//base/@href,@href)"/>
<xsl:text>')</xsl:text>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:basic-link>
</xsl:template>
-
<xsl:template match="xhtml:img|img|xhtml:input[@type='image']|input[@type='image']">
-
<fo:external-graphic content-type="{@type}" src="{concat(//base/@href,@src)}">
<xsl:call-template name="common-atts"/>
</fo:external-graphic>
</xsl:template>
-
<xsl:template match="xhtml:object[starts-with(@type,'image/')]|object[starts-with(@type,'image/')]">
-
<fo:external-graphic content-type="{@type}" src="{concat(//base/@href,@data)}">
<xsl:call-template name="common-atts"/>
</fo:external-graphic>
</xsl:template>
<!-- Tables -->
-
<xsl:template match="xhtml:table">
<xsl:apply-templates select="caption"/>
-
<fo:table width="100%">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates select="colgroup|col"/>
<xsl:variable name="tr1" select="(xhtml:tr|xhtml:thead/xhtml:tr|xhtml:tbody/xhtml:tr|xhtml:tfoot/xhtml:tr)[1]"/>
<xsl:variable name="cols" select="xhtml:colgroup/xhtml:col|xhtml:col"/>
-
<xsl:call-template name="mock-col">
<xsl:with-param name="cols" select="(count($tr1/xhtml:*[not(@colspan)])+sum($tr1/xhtml:*/@colspan))         -(count($cols[not(@colspan)])+sum($cols/@colspan))"/>
</xsl:call-template>
<xsl:apply-templates select="xhtml:thead|xhtml:tfoot|xhtml:tbody"/>
-
<xsl:if test="xhtml:tr">
-
<fo:table-body>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates select="xhtml:tr"/>
</fo:table-body>
</xsl:if>
</fo:table>
</xsl:template>
-
<xsl:template match="table">
<xsl:apply-templates select="caption"/>
-
<fo:table width="100%">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates select="colgroup|col"/>
<xsl:variable name="tr1" select="(tr|thead/tr|tbody/tr|tfoot/tr)[1]"/>
<xsl:variable name="cols" select="colgroup/col|col"/>
-
<xsl:call-template name="mock-col">
<xsl:with-param name="cols" select="(count($tr1/*[not(@colspan)])+sum($tr1/*/@colspan))         -(count($cols[not(@colspan)])+sum($cols/@colspan))"/>
</xsl:call-template>
<xsl:apply-templates select="thead|tfoot|tbody"/>
-
<xsl:if test="tr">
-
<fo:table-body>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates select="tr"/>
</fo:table-body>
</xsl:if>
</fo:table>
</xsl:template>
-
<xsl:template match="xhtml:colgroup|colgroup">
<xsl:apply-templates/>
</xsl:template>
-
<xsl:template name="mock-col">
<xsl:param name="cols" select="1"/>
-
<xsl:if test="$cols>0">
<fo:table-column column-width="proportional-column-width(1)"/>
-
<xsl:call-template name="mock-col">
<xsl:with-param name="cols" select="$cols -1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
-
<xsl:template match="xhtml:col|col">
-
<fo:table-column>
<xsl:call-template name="common-atts"/>
-
<xsl:if test="@span">
-
<xsl:attribute name="number-columns-spanned">
<xsl:value-of select="@span"/>
</xsl:attribute>
</xsl:if>
-
<xsl:choose>
-
<xsl:when test="@width">
-
<xsl:attribute name="column-width">
<xsl:value-of select="@width"/>
</xsl:attribute>
</xsl:when>
-
<xsl:otherwise>
<xsl:attribute name="column-width">proportional-column-width(1)</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</fo:table-column>
</xsl:template>
-
<xsl:template match="xhtml:tbody|tbody">
-
<fo:table-body>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:table-body>
</xsl:template>
-
<xsl:template match="xhtml:thead|thead">
-
<fo:table-header>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:table-header>
</xsl:template>
-
<xsl:template match="xhtml:tfoot|tfoot">
-
<fo:table-footer>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:table-footer>
</xsl:template>
-
<xsl:template match="xhtml:tr|tr">
-
<fo:table-row>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:table-row>
</xsl:template>
-
<xsl:template match="xhtml:th|th">
-
<fo:table-cell font-weight="bold" padding=".1em">
<xsl:call-template name="common-atts"/>
-
<xsl:if test="@colspan">
-
<xsl:attribute name="number-columns-spanned">
<xsl:value-of select="@colspan"/>
</xsl:attribute>
</xsl:if>
-
<xsl:if test="@rowspan">
-
<xsl:attribute name="number-rows-spanned">
<xsl:value-of select="@rowspan"/>
</xsl:attribute>
</xsl:if>
-
<fo:block>
-
<xsl:if test="parent::xhtml:tr/parent::xhtml:thead|parent::tr/parent::thead">
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template>
-
<xsl:template match="xhtml:td|td">
-
<fo:table-cell padding=".1em">
<xsl:call-template name="common-atts"/>
-
<xsl:if test="@colspan">
-
<xsl:attribute name="number-columns-spanned">
<xsl:value-of select="@colspan"/>
</xsl:attribute>
</xsl:if>
-
<xsl:if test="@rowspan">
-
<xsl:attribute name="number-rows-spanned">
<xsl:value-of select="@rowspan"/>
</xsl:attribute>
</xsl:if>
-
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template>
<!-- Lists -->
-
<xsl:template match="xhtml:dd|dd">
-
<fo:list-item>
<xsl:call-template name="common-atts"/>
-
<fo:list-item-label>
<fo:block/>
</fo:list-item-label>
-
<fo:list-item-body start-indent="body-start()">
-
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:template>
-
<xsl:template match="xhtml:dl|dl">
-
<fo:list-block provisional-label-separation=".2em" provisional-distance-between-starts="3em">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:list-block>
</xsl:template>
-
<xsl:template match="xhtml:dt|dt">
-
<fo:list-item>
<xsl:call-template name="common-atts"/>
-
<fo:list-item-label>
<fo:block/>
</fo:list-item-label>
-
<fo:list-item-body start-indent="body-start()">
-
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:template>
-
<xsl:template match="xhtml:ol|ol">
-
<fo:list-block provisional-label-separation=".2em" provisional-distance-between-starts="{string-length(count(li))*.9+.6}em">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:list-block>
</xsl:template>
-
<xsl:template match="xhtml:ol/xhtml:li|ol/li">
-
<fo:list-item>
<xsl:call-template name="common-atts"/>
-
<fo:list-item-label end-indent="label-end()">
-
<fo:block text-align="end">
-
<xsl:variable name="value">
-
<xsl:choose>
-
<xsl:when test="@value">
<xsl:value-of select="@value"/>
</xsl:when>
-
<xsl:otherwise>
<xsl:number/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
-
<xsl:choose>
-
<xsl:when test="@type='I'">
<xsl:number format="I" value="$value"/>
</xsl:when>
-
<xsl:when test="@type='A'">
<xsl:number format="A" value="$value"/>
</xsl:when>
-
<xsl:when test="@type='i'">
<xsl:number format="i" value="$value"/>
</xsl:when>
-
<xsl:when test="@type='a'">
<xsl:number format="a" value="$value"/>
</xsl:when>
-
<xsl:when test="parent::xhtml:ol/@type='I' or parent::ol/@type='I'">
<xsl:number format="I" value="$value"/>
</xsl:when>
-
<xsl:when test="parent::xhtml:ol/@type='A' or parent::ol/@type='I'">
<xsl:number format="A" value="$value"/>
</xsl:when>
-
<xsl:when test="parent::xhtml:ol/@type='i' or parent::ol/@type='I'">
<xsl:number format="i" value="$value"/>
</xsl:when>
-
<xsl:when test="parent::xhtml:ol/@type='a' or parent::ol/@type='I'">
<xsl:number format="a" value="$value"/>
</xsl:when>
-
<xsl:otherwise>
<xsl:number format="1" value="$value"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>.</xsl:text>
</fo:block>
</fo:list-item-label>
-
<fo:list-item-body start-indent="body-start()">
-
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:template>
-
<xsl:template match="xhtml:ul|ul|xhtml:menu|menu">
-
<fo:list-block provisional-label-separation=".2em" provisional-distance-between-starts="1.6em">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:list-block>
</xsl:template>
-
<xsl:template match="xhtml:ul/xhtml:li|ul/li|xhtml:menu/xhtml:li|menu/li">
-
<fo:list-item>
<xsl:call-template name="common-atts"/>
-
<fo:list-item-label end-indent="label-end()">
-
<fo:block text-align="end">
-
<fo:inline font-family="{$font.symbol}">
-
<xsl:choose>
-
<xsl:when test="@type='square'">
<xsl:text disable-output-escaping="yes">&#x25AA;</xsl:text>
</xsl:when>
-
<xsl:when test="@type='circle'">
<xsl:text disable-output-escaping="yes">&#x25CB;</xsl:text>
</xsl:when>
-
<xsl:when test="parent::xhtml:ul/@type='square' or parent::ul/@type='square'">
<xsl:text disable-output-escaping="yes">&#x25AA;</xsl:text>
</xsl:when>
-
<xsl:when test="parent::xhtml:ul/@type='circle' or parent::ul/@type='square'">
<xsl:text disable-output-escaping="yes">&#x25CB;</xsl:text>
</xsl:when>
-
<xsl:otherwise>
<xsl:text disable-output-escaping="yes">&#x2022;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</fo:inline>
</fo:block>
</fo:list-item-label>
-
<fo:list-item-body start-indent="body-start()">
-
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:template>
<!-- Blocks -->
-
<xsl:template match="xhtml:address|address">
-
<fo:block font-style="italic">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:blockquote|blockquote">
-
<fo:block space-before="1em" space-after="1em" start-indent="3em" end-indent="3em">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:br|br">
-
<fo:block white-space="pre">
<xsl:call-template name="common-atts"/>
<xsl:text disable-output-escaping="yes">&#10;</xsl:text>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:caption|caption">
-
<fo:block keep-with-next="always" text-align="center">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:center|center">
-
<fo:block text-align="center">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:div|div|xhtml:multicol|multicol|xhtml:noembed|noembed|xhtml:noframes|noframes   |xhtml:nolayer|nolayer|xhtml:noscript|noscript">
-
<fo:block>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:h1|h1">
-
<fo:block font-size="180%" font-weight="bold">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:h2|h2">
-
<fo:block font-size="160%" font-weight="bold">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:h3|h3">
-
<fo:block font-size="140%" font-weight="bold">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:h4|h4">
-
<fo:block font-size="120%" font-weight="bold">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:h5|h5">
-
<fo:block font-size="110%" font-weight="bold">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:h6|h6|xhtml:legend|legend">
-
<fo:block font-weight="bold">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:hr|hr">
-
<fo:leader leader-pattern="rule" rule-style="groove">
-
<xsl:if test="@size">
-
<xsl:attribute name="rule-thickness">
<xsl:value-of select="@size"/>
<xsl:text>pt</xsl:text>
</xsl:attribute>
</xsl:if>
</fo:leader>
</xsl:template>
-
<xsl:template match="xhtml:listing|listing|xhtml:plaintext|plaintext|xhtml:pre|pre|xhtml:samp|samp">
-
<fo:block white-space="pre">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:p|p">
-
<fo:block space-before=".6em" space-after=".6em">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<!-- Inlines -->
-
<xsl:template match="xhtml:abbr|abbr|xhtml:acronym|acronym">
-
<fo:inline>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
<xsl:text> (</xsl:text>
<xsl:value-of select="@title"/>
<xsl:text>)</xsl:text>
</xsl:template>
-
<xsl:template match="xhtml:b|b|xhtml:strong|strong">
-
<fo:inline font-weight="bold">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:bdo|bdo">
-
<fo:bidi-override direction="{@dir}">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:bidi-override>
</xsl:template>
-
<xsl:template match="xhtml:big|big">
-
<fo:inline font-size="larger">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:blink|blink|xhtml:marquee|marquee">
-
<fo:inline background-color="yellow">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:cite|cite|xhtml:dfn|dfn|xhtml:em|em|xhtml:i|i|xhtml:var|var">
-
<fo:inline font-style="italic">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:code|code|xhtml:kbd|kbd|xhtml:tt|tt">
-
<fo:inline font-family="monospace">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:del|del|xhtml:s|s|xhtml:strike|strike">
-
<fo:inline text-decoration="line-through">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:font|font">
-
<fo:inline>
<xsl:call-template name="common-atts"/>
-
<xsl:choose>
-
<xsl:when test="@size=1">
<xsl:attribute name="font-size">xx-small</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=2">
<xsl:attribute name="font-size">x-small</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=3">
<xsl:attribute name="font-size">small</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=4">
<xsl:attribute name="font-size">medium</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=5">
<xsl:attribute name="font-size">large</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=6">
<xsl:attribute name="font-size">x-large</xsl:attribute>
</xsl:when>
-
<xsl:when test="@size=7">
<xsl:attribute name="font-size">xx-large</xsl:attribute>
</xsl:when>
</xsl:choose>
-
<xsl:if test="@face">
-
<xsl:attribute name="font-family">
<xsl:value-of select="@face"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:ins|ins|xhtml:u|u">
-
<fo:inline text-decoration="underline">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:nowrap|nowrap">
-
<fo:inline wrap-option="no-wrap">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:q|q">
-
<fo:inline>
<xsl:call-template name="common-atts"/>
<xsl:text disable-output-escaping="yes">&#x201C;</xsl:text>
<xsl:apply-templates/>
<xsl:text disable-output-escaping="yes">&#x201D;</xsl:text>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:q|q">
-<xsl:variable name="quot">&quot;</xsl:variable>
  <xsl:if test="starts-with(., $quot)">
    <fo:inline><xsl:call-template name="common-atts"/>
      <xsl:text disable-output-escaping="yes">&amp;#x201C;</xsl:text>
      <xsl:apply-templates/>
      <xsl:text disable-output-escaping="yes">&amp;#x201D;</xsl:text>
    </fo:inline>
  </xsl:if>
</xsl:template>
-
<xsl:template match="xhtml:small|small">
-
<fo:inline font-size="smaller">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:span|span">
-
<fo:inline>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:sub|sub">
-
<fo:inline baseline-shift="sub">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:sup|sup">
-
<fo:inline baseline-shift="super">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<!-- Forms -->
-
<xsl:template match="xhtml:button|button">
-
<fo:block background-color="silver" border="3pt outset silver" text-align="center" width="auto">
<xsl:call-template name="common-atts"/>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
<xsl:text> </xsl:text>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:fieldset|fieldset">
-
<fo:block border="1pt groove gray">
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:form|form">
-
<fo:block>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:input|input">
-
<!--
 default input is text (also handles password & file) 
-->
-
<fo:leader leader-pattern="rule">
<xsl:call-template name="common-atts"/>
-
<xsl:attribute name="leader-length">
-
<xsl:choose>
-
<xsl:when test="@size">
<xsl:value-of select="@size"/>
<xsl:text>em</xsl:text>
</xsl:when>
<xsl:otherwise>10em</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</fo:leader>
</xsl:template>
-
<xsl:template match="xhtml:input[@type='checkbox']|input[@type='checkbox']">
-
<fo:inline font-family="{$font.symbol}" font-size="larger">
<xsl:call-template name="common-atts"/>
-
<xsl:choose>
-
<xsl:when test="@checked">
<xsl:text disable-output-escaping="yes">&#x2611;</xsl:text>
</xsl:when>
-
<xsl:otherwise>
<xsl:text disable-output-escaping="yes">&#x2610;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:input[@type='radio']|input[@type='radio']">
-
<fo:inline font-family="{$font.symbol}" font-size="larger">
<xsl:call-template name="common-atts"/>
-
<xsl:choose>
-
<xsl:when test="@checked">
<xsl:text disable-output-escaping="yes">&#x25C9;</xsl:text>
</xsl:when>
-
<xsl:otherwise>
<xsl:text disable-output-escaping="yes">&#x25CB;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:input[@type='button' or @type='submit' or @type='reset']   |input[@type='button' or @type='submit' or @type='reset']">
-
<fo:block background-color="silver" border="3pt outset silver" text-align="center" width="auto">
<xsl:call-template name="common-atts"/>
<xsl:text> </xsl:text>
-
<xsl:choose>
-
<xsl:when test="@value">
<xsl:value-of select="@value"/>
</xsl:when>
-
<xsl:otherwise>
<xsl:value-of select="@type"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:label|label">
-
<fo:inline>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
<xsl:template match="xhtml:select[@size=1]|select[@size=1]">
-
<fo:leader leader-pattern="rule" leader-length="10em">
<xsl:call-template name="common-atts"/>
</fo:leader>
</xsl:template>
-
<xsl:template match="xhtml:select|select">
-
<fo:block>
<xsl:call-template name="common-atts"/>
-
<xsl:if test="@size">
-
<xsl:attribute name="height">
<xsl:value-of select="@size"/>
<xsl:text>em</xsl:text>
</xsl:attribute>
</xsl:if>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:optgroup|optgroup">
-
<fo:block font-style="italic" font-weight="bold">
<xsl:call-template name="common-atts"/>
<xsl:value-of select="@label"/>
</fo:block>
<xsl:apply-templates/>
</xsl:template>
-
<xsl:template match="xhtml:option|option">
-
<fo:block>
<xsl:call-template name="common-atts"/>
-
<xsl:if test="parent::xhtml:optgroup|parent::optgroup">
<xsl:attribute name="start-indent">1em</xsl:attribute>
</xsl:if>
-
<xsl:choose>
-
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
-
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</xsl:template>
-
<xsl:template match="xhtml:textarea|textarea">
-
<fo:block border="2pt inset silver" height="{@rows}em" width="{@cols}em">
-
<xsl:choose>
-
<xsl:when test="node()">
<xsl:apply-templates/>
</xsl:when>
-
<xsl:otherwise>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</xsl:template>
</xsl:stylesheet>

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632:
633:
634:
635:
636:
637:
638:
639:
640:
641:
642:
643:
644:
645:
646:
647:
648:
649:
650:
651:
652:
653:
654:
655:
656:
657:
658:
659:
660:
661:
662:
663:
664:
665:
666:
667:
668:
669:
670:
671:
672:
673:
674:
675:
676:
677:
678:
679:
680:
681:
682:
683:
684:
685:
686:
687:
688:
689:
690:
691:
692:
693:
694:
695:
696:
697:
698:
699:
700:
701:
702:
703:
704:
705:
706:
707:
708:
709:
710:
711:
712:
713:
714:
715:
716:
717:
718:
719:
720:
721:
722:
723:
724:
725:
726:
727:
728:
729:
730:
731:
732:
733:
734:
735:
736:
737:
738:
739:
740:
741:
742:
743:
744:
745:
746:
747:
748:
749:
750:
751:
752:
753:
754:
755:
756:
757:
758:
759:
760:
761:
762:
763:
764:
765:
766:
767:
768:
769:
770:
771:
772:
773:
774:
775:
776:
777:
778:
779:
780:
781:
782:
783:
784:
785:
786:
787:
788:
789:
790:
791:
792:
793:
794:
795:
796:
797:
798:
799:
800:
801:
802:
803:
804:
805:
806:
807:
808:
809:
810:
811:
812:
813:
814:
815:
816:
817:
818:
819:
820:
821:
822:
823:
824:
825:
826:
827:
828:
829:
830:
831:
832:
833:
834:
835:
836:
837:
838:
839:
840:
841:
842:
843:
844:
845:
846:
847:
848:
849:
850:
851:
852:
853:
854:
855:
856:
857:
858:
859:
860:
861:
862:
863:
864:
865:
866:
867:
868:
869:
870:
871:
872:
873:
874:
875:
876:
877:
878:
879:
880:
881:
882:
883:
884:
885:
886:
887:
888:
889:
890:
891:
892:
893:
894:
895:
896:
897:
898:
899:
900:
901:
902:
903:
904:
905:
906:
907:
908:
909:
910:
911:
912:
913:
914:
915:
916:
917:
918:
919:
920:
921:
922:
923:
924:
925:
926:
927:
928:
929:
930:
931:
932:
933:
934:
935:
936:
937:
938:
939:
940:
941:
942:
943:
944:
945:
946:
947:
948:
949:
950:
951:
952:
953:
954:
955:
956:
957:
958:
959:
960:
961:
962:
963:
964:
965:
966:
967:
968:
969:
970:
971:
972:
973:
974:
975:
976:
977:
978:
979:
980:
981:
982:
983:
984:
985:
986:
987:
988:
989:
990:
991:
992:
993:
994:
995:
996:
997:
998:
999:
1000:
1001:
1002:
1003:
1004:
1005:
1006:
1007:
1008:
1009:
1010:
1011:
1012:
1013:
1014:
1015:
1016:
1017:
1018:
1019:
1020:
1021:
1022:
1023:
1024:
1025:
1026:
1027:
1028:
1029:
1030:
1031:
1032:
1033:
1034:
1035:
1036:
1037:
1038:
1039:
1040:
1041:
1042:
1043:
1044:
1045:
1046:
1047:
1048:
1049:
1050:
1051:
1052:
1053:
1054:
1055:

Select allOpen in new window

 

by: gobicsePosted on 2009-08-24 at 18:18:38ID: 25173944

the modifications which i made so far are in the lines starting from 829 to 839  and in line 2.

 

by: GertonePosted on 2009-08-24 at 23:22:17ID: 25174902

I see, the problem is that you took the stylesheet from the web using internet explorer
and you copied from the browser window.
You should download the raw xslt, not from the browser window but through "view source"
Internet Explorer generates all these "-" to collapse the nodes,
and they are in places not allowed in the stylesheet

you could do a general replace
"- <" into "<"
but you are better off, starting from the raw xslt

 

by: gobicsePosted on 2009-08-25 at 14:06:23ID: 25182260

hi gertone
   thanks for your reply.. i did the same way as you told me.. now i ve got the following error..

" java.net.MalformedURLException: unknown protocol: c
      at java.net.URL.<init>(Unknown Source)
      at java.net.URL.<init>(Unknown Source)
      at java.net.URL.<init>(Unknown Source)
      at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
      at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
      at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
      at fop.Html2PdfFOP.getTransformer(Html2PdfFOP.java:117)
      at fop.Html2PdfFOP.fo2PDF(Html2PdfFOP.java:93)
      at fop.Html2PdfFOP.main(Html2PdfFOP.java:72) "

 

by: abelPosted on 2009-08-25 at 17:23:41ID: 25183509

Perhaps it is a good idea to download a working source somewhere? this may go on for a long time before it's working, apparently this time someone put literal file references in the XSLT file, which is not allowed. They didn't give you a correct XSLT file, it seems. You can only use URI's when it comes to resources:

intead of c:\bla\bla.txt
you writer: file:///c:/bla/bla.txt

 

by: GertonePosted on 2009-08-25 at 23:13:54ID: 25184805

yes please, put the stylesheet here, so we can have a look.
Based on the questions so far, I am afraid that you don't have enough background to mess in a stylesheet as complex a this one.
I am afraid this is going to go on for ever.

Please advise your boss to get you some proper training or hire a consultant, if at some point you find out this is not going to work

 

by: gobicsePosted on 2009-08-25 at 23:15:34ID: 25184811

hi there..
  for ur info.... i am a student.... not working some where...

 

by: gobicsePosted on 2009-08-25 at 23:24:01ID: 25184832

here is the stylesheet... which u asked for..

 

by: GertonePosted on 2009-08-26 at 00:33:41ID: 25185086

hey,

1. If you are a student doing this, I recommend that you take the time to read through some XSLT tutorials
or a bunch of books. You can't shortcut time nor preparation

2. the XSLT you sent is exactly the one you pulled from the web reference above, that one I have.
You are experiencing difficulties with the changes you made. That is the one I would like to see.
Note that you need to run xml-tidy or something similar to guarantuee the wellformedness of your XHTML. DO you do that?

 

by: gobicsePosted on 2009-08-26 at 06:46:15ID: 25187579

hi
 i didnt use JTidy.. do i have to include that jar file in the java build path????.. well i am doing a web crawler project.. i almost finished my project... and i gave user a few options for saving the web page such as text,doc,pdf,html.... now everythin is working fine.. the problem is in the pdf file the images are not coming... so i thought using FOP to do this.. as i dont have much time left.. i have to do like this.. i have got only a weak to finish my project..... as i am working on the report now.. i dont have time to prepare for this.. tats y i need ur help...

 

by: gobicsePosted on 2009-08-26 at 07:12:24ID: 25187867

hi gertone

  i have posted the modified xsl stylesheet in the above post " 08/24/09 06:16 PM, ID: 25173934
" and also i mentioned the  line number which i modified in the next post to that...

instead of these

<xsl:template match="xhtml:q|q[starts-with(.,'"') or starts-with(.,'') or starts-with(.,'?')]">
-
<fo:inline>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-

i added

<xsl:template match="xhtml:q|q">
-<xsl:variable name="quot">&quot;</xsl:variable>
  <xsl:if test="starts-with(., $quot)">
    <fo:inline><xsl:call-template name="common-atts"/>
      <xsl:text disable-output-escaping="yes">&amp;#x201C;</xsl:text>
      <xsl:apply-templates/>
      <xsl:text disable-output-escaping="yes">&amp;#x201D;</xsl:text>
    </fo:inline>
  </xsl:if>
</xsl:template>
-

and i included xmlns:xhtml="http://www.w3.org/1999/xhtml" in the second line.. these are the changes which i made sofar...

 

by: abelPosted on 2009-08-26 at 08:07:52ID: 25188500

>  i dont have time to prepare for this.. tats y i need ur help...    

we are volunteers here, we usually give pointers, but don't do other people's work. If you're in a hurry, a forum is not a good place, instead consider professional services. My suggestion would be to take this one step back. You don't start building a city if you don't know how to build houses and roads. Of course, that's up to you...

apologies if this was not what you hoped to here...

 

by: abelPosted on 2009-08-26 at 08:08:32ID: 25188506

PS: if this is a school assignment or student assignment, we are not really allowed to help, only give pointers to resources etc.

 

by: gobicsePosted on 2009-08-26 at 08:13:32ID: 25188561

i didnt ask you guys to give the complete working solution.. i already have the code.. all i need is ur help to fix the bugs...

 

by: GertonePosted on 2009-08-26 at 08:51:35ID: 25189065

Can you please post the XSLT as you have it now?
I don't believe copying your parts into the original XSLT will work , I did that before I posted, and it does not cause any errors,
there is something else going wrong
So I need your working copy of your stylesheet.

For instance the xhtml namespace is allready in the original stylesheet, so I don't understand why you need to add it.
Neither do I understand where other errors come from.... so please explain the process you are doing.

Is this homework or a study assignment?

 

by: abelPosted on 2009-08-26 at 08:59:24ID: 25189166

> i already have the code.

perhaps I'm missing something here, but the original code was working, wasn't it? Can you make your changes one by one, using an XSLT editor (oXygen, Eclipse (free), Visual Studio (free)) so that you can fix errors while typing? After each edit, run the stylesheet. If problems are in the input, start out with something very simple, validate it on http://validator.w3.org and make sure to fix any errors that come up there.

Once the source is correcvt and you start out with the original stylesheet and add changes one by one, we can actually help you: a huge stylesheet like this one isn't easy for anybody, and requires careful editing and excellent knowledge of XML and XSLT related technologies.

 

by: gobicsePosted on 2009-08-26 at 09:08:56ID: 25189281

ya its working... only exception which i get is
" java.net.MalformedURLException: unknown protocol: c
      at java.net.URL.<init>(Unknown Source)
      at java.net.URL.<init>(Unknown Source)
      at java.net.URL.<init>(Unknown Source)
      at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
      at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
      at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
      at fop.Html2PdfFOP.getTransformer(Html2PdfFOP.java:117)
      at fop.Html2PdfFOP.fo2PDF(Html2PdfFOP.java:93)
      at fop.Html2PdfFOP.main(Html2PdfFOP.java:72) "

 

by: gobicsePosted on 2009-08-26 at 09:12:40ID: 25189330

hi gertone..
  the xslnm:xtml wat not in the original stylesheet... i included it...kindly check the attachment below..
this is the current stylesheet which i am using now...

 

by: gobicsePosted on 2009-08-26 at 09:18:13ID: 25189417

this is a part of 4 credit project... which i finished everything except this pdf conversion....

 

by: abelPosted on 2009-08-26 at 09:31:22ID: 25189571

> ya its working... only exception which i get is
> " java.net.MalformedURLException: unknown protocol: c

I told you already what's wrong there long time ago when you first came with that exception. Please refer back to http:#25183509 on how to solve this.

> the xslnm:xtml wat not in the original stylesheet... i included it...

Using your link that you posted above, I copied the first four lines of the stylesheet below. Are they in or are they in? ;-) I don't know how you copy it, but really, it is all in there...

I am under the impression that you didn't follow up on Gertone's comment to use the source, not the way it is rendered by FF, IE or whatever. Please download the source again to get a valid stylesheet to start with.

Please, we try to help, but that only works if you try to follow up our suggestions or explain why you don't or can't.

-- Abel --

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xhtml="http://www.w3.org/1999/xhtml"
  exclude-result-prefixes="xhtml">
                                              
1:
2:
3:
4:

Select allOpen in new window

 

by: gobicsePosted on 2009-08-26 at 09:33:10ID: 25189584

hi abel

 thanks for your reply... give me some time.. i ll try all your solutions and gertones as well.. and get back to u guys ASAP...

 

by: GertonePosted on 2009-08-26 at 09:37:36ID: 25189626

correction my friend
this is what I found in the original stylesheet

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xhtml="http://www.w3.org/1999/xhtml"
  exclude-result-prefixes="xhtml">

the xhtml namespace declaration IS there

 

by: GertonePosted on 2009-08-26 at 09:40:30ID: 25189658

Nothing wrong with your stylesheet by the way,
it must be the way you call it.
I think you are calling it in a java servlet and the servlet doesn't handle the absolute windows file reference the way you expect it

 

by: gobicsePosted on 2009-08-26 at 09:56:55ID: 25189826

hi gertone

 thanks for your reply.... i am not using servlets in my project..

 

by: GertonePosted on 2009-08-26 at 10:00:06ID: 25189857

any other java code?
The error is likely not in the stylesheet

 

by: GertonePosted on 2009-08-26 at 10:00:34ID: 25189858

What do you do after the XSLT? Do you use FOP?

 

by: gobicsePosted on 2009-08-26 at 10:00:51ID: 25189860

can i post u my java code...

 

by: GertonePosted on 2009-08-26 at 10:01:34ID: 25189872

well you can, but I will not be able to look into it this evening

 

by: abelPosted on 2009-08-26 at 10:03:06ID: 25189889

Gertone is correct, I just double checked and indeed, there are no external references in the XSLT, nor are there files locally referred to.

Probably, the method you use for instantiating needs an URI (like explained earlier) for source and input (and perhaps output too). Make sure you use URIs where they are expected, in your code.

 

by: gobicsePosted on 2009-08-26 at 10:04:25ID: 25189899

ya.. i use FOP to generate PDF files...  i post my code now.. when you have time... have a look at it... thanks

package fop;
 
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
 
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXResult;
 
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.htmlcleaner.CleanerProperties;
import org.htmlcleaner.DomSerializer;
import org.htmlcleaner.HtmlCleaner;
import org.htmlcleaner.TagNode;
import org.w3c.dom.Document;
 
public class Html2PdfFOP {
 
	public static void main(String args[]) throws MalformedURLException{
		
		String html = "http://blogs.sun.com/chrisf/entry/converting_html_to_pdf_using";
		ByteArrayInputStream input = new ByteArrayInputStream(html.getBytes());
		
		System.out.println("HTML BYTES:"+html.getBytes());
		
		
		final HtmlCleaner cleaner = new HtmlCleaner();
		CleanerProperties props = cleaner.getProperties();
 
		DomSerializer doms = new DomSerializer(props, true);
		System.out.println("Doms:" + doms);
		org.w3c.dom.Document xmlDoc = null;
 
		try {
		    TagNode node = cleaner.clean(input);
		    xmlDoc = doms.createDOM(node);
		    System.out.println("XML DOC:" + xmlDoc);
		} catch (Exception e) {
		    e.printStackTrace();
		}
		    
		   
		org.w3c.dom.Document foDoc = null;
 
		try {
		    foDoc = xml2FO(xmlDoc);
		    System.out.println("FO DOC:" + foDoc);
		} catch (Exception e) {
		    System.out.println("ERROR: " + e.getMessage());
		    e.printStackTrace();
		}
		  
	
		try {
			String stylesheet = "C:/Users/Desktop/pdfxsl.xsl";
			
		    OutputStream pdf = new FileOutputStream(new File("C:/Users/Desktop/FOP1.pdf"));
		    pdf.write(fo2PDF(foDoc, stylesheet));
		} catch (java.io.FileNotFoundException e) {
		    e.printStackTrace();
		    System.out.println("Error creating PDF: " + "C:/Users/Desktop/FOP1.pdf");
		} catch (java.io.IOException e) {
		    e.printStackTrace();
		    System.out.println("Error writing PDF: " + "C:/Users/Desktop/FOP1.pdf");
		}
	}
		  
	
	
	 public static byte[] fo2PDF(Document foDocument, String styleSheet) {
		 
		 FopFactory fopFactory = FopFactory.newInstance();
 
		
		    try {
		        ByteArrayOutputStream out = new ByteArrayOutputStream();
 
		        Fop fop = fopFactory.newFop(org.apache.fop.apps.MimeConstants.MIME_PDF, out);
		        Transformer transformer = getTransformer(styleSheet);
 
		        Source src = new DOMSource(foDocument);
		        Result res = new SAXResult((fop).getDefaultHandler());
 
		        transformer.transform(src, res);
 
		        System.out.println("Inside fo2PDF method:" + out.toByteArray());
		        return out.toByteArray();
 
		    } catch (Exception ex) {
		    	System.out.println("Exception occured inside the fo2PDF method....");
		        return null;
		    }
			
	  }
	public static Transformer getTransformer(String styleSheet) {
		try {
	        TransformerFactory tFactory = TransformerFactory.newInstance();
 
	        DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
	        dFactory.setNamespaceAware(true);
 
	        DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
	        
	        Document xslDoc = dBuilder.parse(styleSheet);
	        DOMSource xslDomSource = new DOMSource(xslDoc);
	        System.out.println("Inside getTransformer method:" + xslDomSource);
	        return tFactory.newTransformer(xslDomSource);
	    } catch (javax.xml.transform.TransformerException e) {
	        e.printStackTrace();
	        return null;
	    } catch (java.io.IOException e) {
	        e.printStackTrace();
	        return null;
	    } catch (javax.xml.parsers.ParserConfigurationException e) {
	        e.printStackTrace();
	        return null;
	    } catch (org.xml.sax.SAXException e) {
	        e.printStackTrace();
	        return null;
	    }
	}
 
 
	public static Document xml2FO(Document xml) throws Exception {
		
		System.out.println("first of xml2Fo method is ... "+ xml);
		DOMSource xmlDomSource = new DOMSource(xml);
	    DOMResult domResult = new DOMResult();
 
	    TransformerFactory factory = TransformerFactory.newInstance();
	    Transformer transformer = factory.newTransformer();
 
	    if (transformer == null) {
	       System.out.println("Error creating transformer");
	       System.exit(1);
	    }
 
	    try {
	        transformer.transform(xmlDomSource, domResult);
	    } catch (javax.xml.transform.TransformerException e) {
	        return null;
	    }
 
	    System.out.println("Inside xml2FO method:"+(Document)domResult.getNode());
	    return (Document) domResult.getNode();
	}
	
}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:

Select allOpen in new window

 

by: abelPosted on 2009-08-26 at 10:04:32ID: 25189901

> can i post u my java code...

you will likely have much better chances on the java zones, they are very lively and responsive, esp with brief and clear questions. Post a minimal example that illustrates your problem and you'll likely to quickly have your answer ;-)

 

by: abelPosted on 2009-08-26 at 10:08:44ID: 25189931

My java is a bit rusty recently, but try this:

new File("C:\\Users\\Desktop\\FOP1.pdf")

on all places where you need a file. Perhaps the transition from pathname to abstract pathname does not go well because you do not match the separator char...

 

by: gobicsePosted on 2009-08-26 at 10:10:26ID: 25189946

hi abel
 thanks for your reply.. i ll try tat n get back to u...

 

by: GertonePosted on 2009-08-26 at 10:55:16ID: 25190355

It is generally not a good idea to combine steps when debugging.
Note that this started off as a pure XSLT question and now has become a pure Java question.
You can't debug all-in-on.
Isolate bits and check each bit in turn. Integrate after you are completely sure of the single bits
It took abel and me an awfull lot of time to get to a point that there is no longer an issue in the XSLT

Your a student, well learn from this comment please
A forum is generally a good place to get solutions, for isolated bits, not for full integrations
It is your task to isolate the problem

Here is how you should go about a project like this
- Develop the XSLT, preferably using an IDE, specially for a complex hump like this one,
- "Unit" test the XSLT, command line, using the exact same processor as you will use in the java code
- Run FOP on the resulting XSL-FO file, command line. This way, spot errors in your XSL-FO early
- Use the java code to create the XSL-FO, using the XSLT, leave the FOP bit out
- integrate the FOP process in the java, after all previous steps are succesfull

If you do it that way, you would be able to ask the right question, on the right forum

 

by: abelPosted on 2009-08-26 at 17:16:36ID: 25193531

excellent structure, Gertone, I fully second that approach. New technologies don't always come easy and never come overnight. XSLT is no exception and to learn to understand, you best play with it a while. XSLT also requires XML, HTTP and, very important, XML Namespaces knowledge, . Making PDF requires also XSL-FO and (possibly) SVG knowledge. None of these are easy and each of them can take months to master. Do them a step at the time is probably the best advice we can give you here.

 

by: gobicsePosted on 2009-08-26 at 19:11:43ID: 25194017

hey guys..
 thanks for your help... i ll assign the points for both of u for your timely help..

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...