xsl-list
[Top] [All Lists]

RE: [xsl] Combine content of separate elements

2006-11-14 16:17:27
I'm always confused by the predicate combination and use of the self axis.

Thanks.  I'll try it out.

-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: Tuesday, November 14, 2006 5:15 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Combine content of separate elements


 What I want to do is combine the 
content of a <para> with the next <para2> but only if another 
<para> do not occur between the first <para> and <para2>.

Sounds like

<xsl:template match="para">
  <p>
   <xsl:apply-templates/>
   <xsl:apply-templates
select="following-sibling::*[self::para|self::para2][1][self::para2]"/>
  </p>
</xsl:template>

In English: the first following sibling that is a para or para2, provided it
is a para2.

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Cutter [mailto:cutter1994(_at_)gmail(_dot_)com] 
Sent: 14 November 2006 21:53
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Combine content of separate elements

<para>This is the start of a paragraph.  Then a page break 
occurs.  The paragraph</para> <table id = "2"/> 
<pageBreak><num>106</num></pageBreak>
<table id = "3"/>
<pageBreak><num>107</num></pageBreak>
<para2>continues here.</para2>

I want to combine the content of <para2> with <para>.  The 
problem is that there can be any type of elements as a 
following-sibling between a <para> and a <para2> except 
another <para> or <para2>.  What I want to do is combine the 
content of a <para> with the next <para2> but only if another 
<para> do not occur between the first <para> and <para2>.

Here's what I currently have:
<xsl:if test="following-sibling::pageBreak[following-sibling::para2]">
 <xsl:text>&#x20;</xsl:text><xsl:apply-templates
select="following-sibling::para2[1]"/>
</xsl:if>

This outputs with the <para2> content in every <para> that 
precedes a <pageBreak>.

The stylsheet I am using is 2.0 but I haven't figured out 
what 2.0 feature will let me do this easily.

Thanks the help. 

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.430 / Virus Database: 268.14.5/533 - Release 
Date: 11/13/2006
8:56 PM
 


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

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.430 / Virus Database: 268.14.5/533 - Release Date: 11/13/2006
8:56 PM
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.430 / Virus Database: 268.14.5/533 - Release Date: 11/13/2006
8:56 PM
 


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