xsl-list
[Top] [All Lists]

RE: [xsl] Splitting content from sub-elements

2009-06-16 09:51:16
Hello,

This stylesheet:

<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="Paragraph">
        <para>
                <xsl:apply-templates/>
                </para>
        </xsl:template>
<xsl:template match="Text[(_at_)Cstyle='Cursief']">
        <emphasis role="italic">
                <xsl:apply-templates/>
                </emphasis>
        </xsl:template>
<xsl:template match="Text">
        <xsl:apply-templates/>
        </xsl:template>
<xsl:template match="FootNote">
        <footnote label="{(_at_)ID}">
                <xsl:apply-templates/>
                </footnote>
        <xsl:text> </xsl:text>
        </xsl:template>
</xsl:stylesheet>

outputs:

<para>
     A line of text.
     <emphasis role="italic">Another line of text.</emphasis>
     A 3rd line of text<footnote label="14">
         <para>
             This is the content  
of the footnote.
         </para>
     </footnote> that contains a footnote.
     <emphasis role="italic">A 4th line of text.</emphasis>
     A 5th line of text that  
also<footnote label="15">
         <para>
             This is the 2nd  
footnote.
         </para>
     </footnote> a footnote.
</para>

... but I don't understand what you mean by "split"? so maybe
I didn't quite get what your problem is?

HTH anyway!
Regards,
EB

-----Original Message-----
From: Casper Voortman [mailto:casper(_dot_)voortman(_at_)publiqare(_dot_)nl]
Sent: Tuesday, June 16, 2009 3:31 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Splitting content from sub-elements


Hello Everyone,

I'm having trouble with breaking down a piece of XML into a simpler  
structure by using xslt 1.0.

The problem concentrates itself specifically around splitting the  
content within a <Text> element from the <FootNote>, which is also  
part of the same element <Text >, and still keeping the order within  
the <Paragraph> intact.

Any suggestions would be much appreciated.

The original XML:

<Paragraph Pstyle="Plattetekst">
     <Text Cstyle="[No character style]">A line of text.</Text>
     <Text Cstyle="Cursief">Another line of text.</Text>
     <Text Cstyle="[No character style]">A 3rd line of text<FootNote  
ID="14">
         <Paragraph Pstyle="Voetnoot">
             <Text Cstyle="[No character style]">This is the content  
of the footnote.</Text>
         </Paragraph>
     </FootNote>that contains a footnote.</Text>
     <Text Cstyle="Cursief">A 4th line of text.</Text>
     <Text Cstyle="[No character style]">A 5th line of text that  
also<FootNote ID="15">
         <Paragraph Pstyle="Voetnoot">
             <Text Cstyle="[No character style]">This is the 2nd  
footnote.</Text>
         </Paragraph>
     </FootNote>a footnote.</Text>
</Paragraph>

The desired XML:

<para>
      A line of text. <emphasis role="italic">Another line of text.</ 
emphasis> A 3rd line of text<footnote label="14">
              <para>This is the content of the footnote.</para>
      </footnote> that contains a footnote. <emphasis 
role="italic">A 4th  
line of text.</emphasis> A 5th line of text that also<footnote  
label="15">
              <para>This is the 2nd footnote.</para>
      </footnote> a footnote.
</para>

Regards,

Casper Voortman

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>