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

match + default namespace

Subject: match + default namespace
From: philippe drix <phdrix@xxxxxxx>
Date: Fri, 16 Nov 2001 16:03:22 +0100
xsl template match default
Hi!
Sorry if my question is FAQ, but I found nothing in the archive.

I have a small xml file, like this :

------------------------------------------------------------
<foo>
  <table xmlns="http://abcd" border="1" bgcolor="#E0E0E0">
	 <caption align="right" class="listingTitle">bar.java</caption>
	 <tr>
		<td>
			<pre class="programlisting">
import java.io.*;
public class bar {
		...
	}
}</pre>
			</td>
		</tr>
	</table>
</foo>
--------------------------------------------------------------

I want to write a XSL Transformation, with a rule matching <pre> like
this :


    <xsl:template match="pre[@class='programlisting']">
    	<pre class="programlisting">
    	     <xsl:call-template name="replace_first_tabs_on_all_lines">
			<xsl:with-param name="codeSource" select="." />
		</xsl:call-template>
    	</pre>
    </xsl:template>
    
    
and a another rule like this :

    <xsl:template match="*">
		<xsl:copy>
			<xsl:apply-templates select="@*"/>
			<xsl:apply-templates/>
		</xsl:copy>
		
    </xsl:template>
    
    
The problem is that the pattern "pre[@class='programlisting']" never
matches the tag <pre>.

Why ? Because it is too much selective. Even if I relax it, like that :
match="pre", it is still too selective.
To get the match, I must write : match="*[name() = 'pre']".

So, match="pre" is not the same than match="*[name() = 'pre']"
Actually, this oddity disappears if I suppress the default namespace
declared with the <table> element.

Why ? This time, I have not really the true answer ...

Any idea ?

Best regards,
Philippe Drix
www.objectiva.fr

 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.