xsl-list
[Top] [All Lists]

Re: [xsl] creating elements and hierarchy

2007-11-08 04:27:18
Quoting Andrew Welch <andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com>:

On 08/11/2007, Andreas Peter <info(_at_)minimag(_dot_)de> wrote:
Hello XSL-List,

I have the following problem:

I have a XML-file which is not very well structured. My aim is to
include different parent elements just for getting a better structure.

This is the source (in extracts):

<root>
     <textabschnitt>
         <h1> ... </h1>
         <p> ... </p>
     </textabschnitt>
</root>

I try to include an element <headings> as parent element for every
<h1> element and use the following transformation:

<xsl:template match="h1">
             <xsl:element name="ep:headings">
                 <xsl:element name="ep:h1">
                     <fo:block xsl:use-attribute-sets="h1">
                         <xsl:value-of select="."/>
                     </fo:block>
                 </xsl:element>
             </xsl:element>
     </xsl:template>

Unfortunately nothing happens to my fo-output.

I would be very thankful for every hint solving my problem.


You are either not calling apply-templates on the h1 element, or the
default namespace is not null.

Either way you'll need to show a bit more code..


cheers
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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





Hello Andrew,

thanks for the reply. I used xsl:apply-templates, too, but the result was the same.

More code:
<Root>
    <Textabschnitt>
<fn>[<info_h>auf Rückseite der letzten Inhaltsverzeichnisseite:</info_h> 1885 Duala etwas 20.000 Einwohner </fn>
        <fn>Cameraes [?] weiße Krabben </fn>
        <fn>Duala lügnerisch, faul, zänkisch, prozeßtüchtig [?] ] </fn>
        <p> </p>
        <p> </p>
<h1>Geistiger Volksbesitz der Kameruner im Blickfeld des Missionars</h1>
        <h2>Einführung</h2>
        <p> </p>...

For every h1, h2, ... element a parent element <headings> should be included, for every <p> element an parent element <continuoustext> should be includes and so on. Just for testing with the aim to get a docbook structure later.

I also tried to use literal results like

<xsl:template match="h1">
            <xsl:if=".">
               <ep:headings>
                   <ep:h1>
                     <fo:block xsl:use-attribute-sets="h1">
                         <xsl:apply-templates/>
                     </fo:block>
                   </ep:h1>
               </ep:headings>
    </xsl:template>

I added the namespace xmlns:ep="http://www.minimag.de/elpub

I hope this helps. Thanks so much,
Andreas



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