Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] remove certain elements but keep children

From: Ben Munat <bent@--------->
To:
Date: 10/4/2004 2:15:00 AM
Hmmm, seems my enthusiasm was premature... can't get any of the 
suggestions to work. I must be applying it wrong... or maybe my little 
sample doc in my first email was misleading. Here's a more exact file 
I'm working with:



-------input file:--------------



<?xml version="1.0" encoding="UTF-8"?>
<output type="root">
   <output type="static" id="3014deec-86c8-b69f-8c21-7420ac545008">
      <div class="header">
         <p class="tagline">My Site is great</p>
         <h1 class="logo">MYSITE</h1>
      </div>
   </output>

   <output type="static">
      <div class="page-body">
         <output type="static">
            <div class="sidebar">
               <output type="static" >
                  <div class="navbar">
                     <h2 class="navbar-title">The Site</h2>
                     <ul class="navbar-links">
                        <li>
                           	<a class="navbar" href="/Focus/">
					Focus
				</a>
                        </li>

                        <li>
                        	<a class="navbar" href="/History/">
					History
				</a>
                        </li>

                        <li>
                           <a class="navbar" href="/Activities/">
					Activities
				</a>
                        </li>
                     </ul>
                  </div>
               </output>

               <output type="login">
                  <div class="sidebar-box">
                     <form class="site-login"
			action="http://localhost:8080/" method="post">
                        <h2 class="sidebar-title">Log In</h2>

                        <p class="sidebar-text">
                           <label for="user-name">Username:</label>
                           <input id="user-name" name="user_name"
				type="text" size="16" />
                           <br />
                           <label for="user-password">Password:</label>
                           <input id="user-password"
				name="user_password"
				type="password" size="16" />
                           <input id="user-login" name="user_login"
				type="submit" value="log in" />
                        </p>

                        <p class="sidebar-link">
                           <a class="sidebar" 	
				href="/Register/">Register</a>
                           <br />
                           <a class="sidebar"
				href="/ResetPassword/">
					Reset Password</a>
                        </p>
                     </form>
                  </div>
               </output>
            </div>
         </output>

         <output type="static" >
            <h3 class="article-title">What is the BEACONS Project?</h3>

            <div class="article-body">
			<p>Lobore et dolore nagna aliquam erat volupat.
			At enim ad minimin veniami
			quis nostrud exercitation lorem ipsum dolor sit
			amet, consectetur adips cing
			elit, diam nonnumy eiusmod tempor incidunt ut
			ullamcorper suscripit laboris nisi
			ut alquip exea commodo consequat, consectetur
			adips cing elit. Ullamcorper
			suscripit laboris nisi ut alquip exea commodo
			consequat, consectetur adips
			cing elit.</p>

			<p>Lobore et dolore nagna aliquam erat volupat.
			At enim ad minimin veniami
			quis nostrud exercitation lorem ipsum dolor sit 	
			amet, consectetur adips cing
			elit, diam nonnumy eiusmod tempor incidunt ut
			ullamcorper suscripit laboris nisi
			ut alquip exea commodo consequat, consectetur
			adips cing elit. Ullamcorper
			suscripit laboris nisi ut alquip exea commodo
			consequat, consectetur adips
			cing elit.</p>
            </div>
         </output>
      </div>
   </output>

   <output type="static" id="eb2260c3-5ca5-fd34-6b28-64613dc1b67a">
      <p class="global-links">
         <a class="global" href="/ContactUs/"
		title="Contact the webmaster">ContactUs</a>

         <a class="global" href="/PrivacyPolicy/"
		title="How we handle your private data">
		PrivacyPolicy</a>

         <a class="global" href="/TermsOfUse/"
		title="Terms and conditions for using this site">
		TermsofUse</a>
      </p>
   </output>

   <output type="static" id="1ac7a8b0-5665-3aaa-5c3c-1ad58a630ee2">
      <div class="code-links">
         <a href="http://validator.w3.org/" title="Valid XHTML 1.1">
		XHTML</a>

         <a href="http://jigsaw.w3.org/css-validator/"
		title="Valid CSS 2">CSS</a>

         <a href="http://www.w3.org/WAI/WCAG1AA-Conformance"
		title="Accessible to AA WCAG 1.0">WCAGAA</a>
      </div>
   </output>
</output>

-------------------------------------



I'm trying to simply remove the opening an closing "output" tags. Here's 
my latest attempt:



<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output omit-xml-declaration="no"/>



    <xsl:template match="/">
    	
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
            <head>
            </head>
            <body>
		<xsl:apply-templates select="*"/>
            </body>
        </html>

    </xsl:template>



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

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

Although I've tried several variations in the "match" and "select" 
attributes. I always seem to get not quite all the html elements or I 
get multilple copies of stuff.



What am I doing wrong?



Thanks,



Ben


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent