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

Re: XHTML->XHTML w/ XSLT, modifying only specific ele

Subject: Re: XHTML->XHTML w/ XSLT, modifying only specific element(s)
From: Evan Nemerson <assorted@xxxxxxxxxxxxxxx>
Date: Mon, 25 Oct 2004 15:01:27 -0700
xhtml blockquote
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?

> >   <xsl:template match="blockquote[@cite and @title]">
>
> I suspect you want match="xhtml:blockquote[@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()"/>
      <a class="serendipity_blockquoteReferenceLink" href="{@cite}">
        <xsl:value-of select="@title"/>
      </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@xxxxxxxxxxxxxxx
http://coeusgroup.com/en

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.