xsl-list
[Top] [All Lists]

Re: [xsl] Wrapping pieces of content separately

2006-08-24 15:52:06
Jay Bryant wrote:

  Hi

  <xsl:template match="p[*]">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="p">
    <p><xsl:apply-templates/></p>
  </xsl:template>

  <xsl:template match="text()[parent::p[*]]">
    <p><xsl:value-of select="."/></p>
  </xsl:template>

  I'd write "text()[parent::p[*]]" as "p[*]/text()".  Take care with:

    <p>onetwo</p>
    <p>one<!-- -->two</p>

you'll get:

    <p>onetwo</p>
    <p>one</p>
    <p>two</p>

because of the use of text().

  Regards,

--drkm
























        
 p4.vert.ukl.yahoo.com uncompressed/chunked Thu Aug 24 22:13:39 GMT 2006 
        
                
___________________________________________________________________________ 
Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet 
! 
Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos 
expériences. 
http://fr.answers.yahoo.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>