|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] match + default namespace
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








