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

Re: xsl:apply-templates behaving differently depending

Subject: Re: xsl:apply-templates behaving differently depending on the node copied?
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Wed, 11 May 2005 04:49:29 -0700 (PDT)
xsl apply templates select body.content
This may be done as below.. This is a modified
identity stylesheet.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" indent="yes" />

<xsl:template match="node() | @*">
  <xsl:copy>
    <xsl:apply-templates select="node() | @*" />
  </xsl:copy>
</xsl:template>

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

<xsl:template match="content">
  <body>
    <div id="content">
      <xsl:apply-templates />
    </div>  
  </body>
</xsl:template>

</xsl:stylesheet>

Regards,
Mukul


--- knocte <knocte@xxxxxxxxx> wrote:
> Hello.
> 
> I need to use xsl:apply-templates but I want it to
> behave in some way
> when it comes to copy a predefined tag in special
> circumstances, can
> it be done? Let me explain:
> 
> I already have a XSLT file that will parse this XML
> file:
> 
> <page>
>   <head>
>     <title>Example</title>
>   </head>
> 
>   <content>
>     <h1>Example</h1>
>     <table>
>       <tr>
>         <td></td>
>         <td>Something #1</td>
>       </tr>
>       <tr>
>         <td>Somthing #2</td>
>         <td />
>       </tr>
>     </table>
>   <content>
> </page>
> 
> 
> And it will convert it to the following:
> 
> <html>
>   <head>
>     <title>Example</title>
>   </head>
>   <body>
>     <div id="content">
>       <h1>Example</h1>
>       <table>
>         <tr>
>           <td></td>
>           <td>Something #1</td>
>         </tr>
>         <tr>
>           <td>Something #2</td>
>           <td />
>         </tr>
>       </table>
>     </div>
>   <body>
> </html>
> 
> 
> Using:
> 
> [...]
> <div id="content">
>   <xsl:apply-templates select="content/*" />
> </div>
> [...]
> 
> 
> But how can I use apply-templates to obtain the
> following?:
> 
> <html>
>   <head>
>     <title>Example</title>
>   </head>
>   <body>
>     <div id="content">
>       <h1>Example</h1>
>       <table>
>         <tr>
>           <td>________NOTHING!_______</td>
>           <td>Something #1</td>
>         </tr>
>         <tr>
>           <td>Something #2</td>
>           <td>________NOTHING!_______</td>
>         </tr>
>       </table>
>     </div>
>   <body>
> </html>
> 
> 
> 
> Thanks in advance.
> 
> 	Andrew
> 
> --
> 
> 


		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 

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.