[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: transformation does happen after copy-of?

Subject: RE: transformation does happen after copy-of?
From: Américo Albuquerque <aalbuquerque@xxxxxxxxxxxxxxxx>
Date: Tue, 23 Jul 2002 10:54:29 +0100
p element transformation
Hi!
Try this template instead
<xsl:template match="@*|node()">
   <xsl:copy>
     <xsl:apply-templates select="@*|node()"/>
   </xsl:copy>
</xsl:template>

I supose that the attribute nodes does't get selected in the node()
function, so, when you do a match="node()" you are selecting all nodes
except attribute nodes, but these also have text nodes (that contain
there values) and these are selected by the match="node()"


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Phillip
Rhodes
Sent: Tuesday, July 23, 2002 4:26 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Cc: mike@xxxxxxxx
Subject: Re:  transformation does happen after copy-of?


I tried the solution.  It definitely seems like the right direction.  It

did transformations of all the whitespace elements, as you said it 
would.  thanks.

However, the transformation has an unintended effect of moving all 
attribute values to the content of an element.

For example
             <td width="40" />
             <td width="550">
                <p>
                   <whitespace lines="8" inches="1.25" />
                   <p align="right">

Was transformed to:
             <td>40</td>
             <td>
                550
                <p>
                   <p>


Thanks.  Still working at it!

At 09:46 PM 7/21/2002 -0600, Mike Brown wrote:
>Phillip Rhodes wrote:
> >     <xsl:template match="html">
> >          <xsl:copy-of select="."/>
> >          <xsl:apply-templates/>
> >     </xsl:template>
>
>copy-of will copy an entire branch of the tree. So you asked for all of

>the 'html' element, including its descendants, to be copied verbatim. 
>Your apply-templates along with the built-in templates sent you down 
>into the source tree, but your template for whitespace never matched 
>because you were looking for whitespace[lines] which means whitespace 
>element having at least 1 lines element child. @lines was what you 
>meant, but that's not helpful either.
>
>This is the meat of the stylesheet you want -- an identity transform, 
>with overrides for whitespace elements:
>
><xsl:template match="node()">
>   <xsl:copy>
>     <xsl:apply-templates select="@*|node()"/>
>   </xsl:copy>
></xsl:template>
>
><xsl:template match="whitespace">
>   <p/>
>   <p/>
></xsl:template>
>
>I suspect you want the lines attribute of the whitespace element to 
>determine how many 'p' elements (or 'br' elements inside one 'p', 
>probably) to insert? In that case, a recursive template (untested, but 
>should do the trick):
>
><xsl:template match="whitespace">
>   <p>
>     <xsl:call-template name="insert-brs">
>       <xsl:with-param name="num" select="number(@lines)"/>
>     </xsl:call-template>
>   </p>
></xsl:template>
>
><xsl:template name="insert-brs">
>   <xsl:param name="num"/>
>   <xsl:if test="$num > 0">
>     <br/>
>     <xsl:call-template name="insert-brs">
>       <xsl:with-param name="num" select="$num - 1"/>
>     </xsl:call-template>
>   </xsl:if>
></xsl:template>
>
>
>    - Mike 
>_______________________________________________________________________
_____
>   mike j. brown                   |  xml/xslt: http://skew.org/xml/
>   denver/boulder, colorado, usa   |  resume:
http://skew.org/~mike/resume/
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.