On Monday 25 Oct 2004 15:01, Evan Nemerson wrote:
First off, thank you both for your replies--they really helped.
Unfortunately, I have new problem:
It seems that Firefox (as well as xsltproc) want to output an xmlns="" in
the link tag, which seems reasonable enough to me. However, when that
attribute is present Firefox refuses to treat links as such--it does
nothing when I click on it, the cursor is the same for :hover, etc. Is
there any way to suppress the xmlns attribute?
Never mind, I figured it out--just had to clarify that the a element is in the
xhtml namespace. I've adjusted my XSLT below to reflect.
<xsl:template match="blockquote[(_at_)cite and @title]">
I suspect you want match="xhtml:blockquote[(_at_)cite and @title]" ...
though
you don't give a snippet of your input XHTML, you probably are using the
default namespace. XPath 1.0 does not use the default namespace.
You are, of course, correct. Here's what I have now, which is /almost/
working:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="xhtml:blockquote">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xhtml:a class="serendipity_blockquoteReferenceLink" href="{(_at_)cite}">
<xsl:value-of select="@title"/>
</xhtml:a>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
(To anyone reading this in the archive, note the two namespaces in the
xsl:stylesheet element, one of which corresponds to the second
xsl:template's match attribute.)
Nothing I put in that second xsl:template element seems to have any
effect.
I'm guessing that your input has a namespace associated with the default
namespace ... your element names are not prefixed but your qualified
names probably have non-null associated namespace URIs. The way you
wrote your template rule was matching "blockquote" in no namespace, not
"blockquote" in the XHTML namespace.
Sorry to post such a simple question, but I'm completely stumped.
It is a FAQ to ask why a non-prefixed element name in a match is not
matching elements from a namespace.
I was, unfortunately, a bit too ignorant to even know the proper question
to look for in the FAQ :(. Sorry.
I hope this helps.
It did--thank you both again.
--
Evan Nemerson
evan(_at_)coeus-group(_dot_)com
http://coeusgroup.com/en