Pergunta

I have got a little problem...

But first:

Here is my XML file:

    <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE akweny SYSTEM "akweny.dtd">
<akweny>
    <akwen>
        <nazwa>Atlantycki</nazwa>
        <typ>ocean</typ>
        <powierzchnia>106450</powierzchnia>
        <akweny>
            <akwen>
                <nazwa>Północne</nazwa>
                <typ>morze</typ>
                <powierzchnia>750</powierzchnia>
            </akwen>
            <akwen>
                <nazwa>Batyckie</nazwa>
                <typ>morze</typ>
                <powierzchnia>386</powierzchnia>
                <akweny>
                    <akwen>
                        <nazwa>Botnicka</nazwa>
                        <typ>zatoka</typ>
                        <powierzchnia>117</powierzchnia>
                    </akwen>
                </akweny>
            </akwen>
        </akweny>
    </akwen>
    <akwen>
        <nazwa>Spokojny</nazwa>
        <typ>ocean</typ>
        <powierzchnia>179700</powierzchnia>
    </akwen>
</akweny>

How to generate PDF file using Xquery?

I have got like this:

<table border="1" width="100%">
    <th>Podrzędne</th><th>Nazwa</th><th>Typ</th><th>Powierzchnia</th><th>Edycja</th>
        { 
       let $nodes := doc('/db/Dane/akweny.xml')//akweny[ancestor::*/nazwa="Atlantycki"]
        for $x in $nodes/*
        let $nazwa := $x/nazwa/text()
        let $typ := $x/typ/text()
        let $powierzchnia := $x/powierzchnia/text()
            return 
            <tr>
    <th><img src="/exist/apps/Obrazki/lupa.jpg" alt="Podrzedny" /></a></th>
                <th bgcolor="#F46978">{$nazwa}</th>
                <th>{$typ}</th>
                <th>{$powierzchnia}</th>
<th>Edytuj</th>
            </tr>

And so it was not so good file must be generated after clicking on the PRINT button...

Any sugestion? I'm working on it for over a week and I can not deal with this snap out of it ...

Foi útil?

Solução

eXist-db can generate PDFs using the XSL-FO module, which by default is configured to use Apache FOP. The idea is that if you can transform your XML into XSL-FO, then you can pass the XSL-FO to the XSL-FO module, which will then generate the PDF for you. The module's functions are documented at http://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/xslfo. This module is not enabled by default, so here's what you need to do:

  1. Quit eXist-db if it's running.

  2. Edit $EXIST_HOME/extensions/local.build.properties (or if you do not have this file, duplicate the build.properties file in that directory, and rename the duplicate local.build.properties) to turn the line include.module.xslfo = false to include.module.xslfo = true.

  3. Rebuild eXist-db with build.sh rebuild (or build.bat rebuild on Windows)

  4. Uncomment the XSL-FO module in conf.xml, the block beginning with <module uri="http://exist-db.org/xquery/xslfo" class="org.exist.xquery.modules.xslfo.XSLFOModule">

  5. Restart eXist-db

  6. Now you can use the xslfo:render() function.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top