Re: XSL content:encoded troubles
Martin Honnen <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Liberty Development |
| Message-ID | <[email protected]> |
Michael Vincent van Rantwijk wrote:
> First of all, there's no XSL newsgroup so I'll have to post my question
> in the *mozilla.style and mozilla.xml newsgroup, because I don't know
> which one to use (and maybe these are both wrong).
For Mozilla specific XSLT questions there is the newsgroup
netscape.public.mozilla.layout.xslt. But the topic there is not general
XSLT questions.
> My question is: should something like this work in Mozilla?
>
> <xsl:attribute name="description">
> <xsl:choose>
> <xsl:when test="content:encoded">
> <xsl:value-of select="content:encoded"/>
> </xsl:when>
> <xsl:otherwise>
> <xsl:value-of select="description"/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:attribute>
>
> To read/assign the data of:
>
> <content:encoded>
> <content:encoded>
Is that supposed to be a snippet of XML? Then it should probably look
<content:encoded>
</content:encoded>
As for the XSLT it looks fine as a snippet but of course to write an
XPath expression like e.g. content:encoded you need to make sure that
the prefix content is bound to a namespace URI. So make sure your
stylesheet element for instance has e.g.
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:content="http://example.com/2005/09/01/n1">
where you replace http://example.com/2005/09/01/n1 with the namespace
URI the elements in the source document are in.
--
Martin Honnen
http://JavaScript.FAQTs.com/