Subject: Re: [xsl] XHTML to XHTML transform From: Robert Koberg <rob@xxxxxxxxxx> Date: Fri, 02 Apr 2004 17:58:36 -0800 |
-----Original Message-----
From: Jeffrey Moss [mailto:jeff@xxxxxxxxxxxx] Sent: 02 April 2004 21:55
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] XHTML to XHTML transform
How do I match text nodes in my custom namespace? As in override the default
text node template for "mynamespace"?
All my variables <mynamespace:name>blah</mynamespace:name> for instance
appear as text in the results, I've tried this:
<xsl:template match="text()[namespace-uri()='mynamespace:namespace']"> </xsl:template>
but that doesn't work... I ended up changing all the elements I want hidden
under all circumstances to the mynamespace-var namespace...
<xsl:template match="*[namespace-uri()='mynamespace-var:namespace']"> </xsl:template>
This works, but I think its messy, I was wondering if there was a better
way? I'm pasting my code below.
Thanks,
-Jeff
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:nbn="nbn:namespace" xmlns:nbn-run="nbn-run:namespace" xmlns:nbn-var="nbn-var:namespace" exclude-result-prefixes="nbn nbn-run nbn-var"> <xsl:param name="controller" select="'index.php'"/> <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/sitemap"> <DIV CLASS="navtree"> <xsl:apply-templates /> </DIV> </xsl:template>
<xsl:template match="*[not(namespace-uri())]"> <xsl:copy> <xsl:apply-templates /> </xsl:copy> </xsl:template>
<xsl:template match="text()"> </xsl:template>
<xsl:template match="*[namespace-uri()='nbn-var:namespace']"> </xsl:template>
<xsl:template match="nbn:link">
<xsl:element name="A">
<xsl:attribute name="HREF">/<xsl:value-of
select="$controller"/>/module/<xsl:value-of
select="nbn-var:location/nbn-var:module" />/action/<xsl:value-of
select="nbn-var:location/nbn-var:action" />/</xsl:attribute>
<xsl:attribute name="ID"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:attribute name="CLASS">menuitem</xsl:attribute>
<xsl:value-of select="@name"/>
</xsl:element>
<xsl:apply-templates />
<BR/>
<xsl:if test="link">
<xsl:element name="DIV">
<xsl:attribute name="CLASS">submenu</xsl:attribute>
<xsl:apply-templates select="link"/>
</xsl:element>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XHTML to XHTML transform, Robert Koberg | Thread | Re: [xsl] XHTML to XHTML transform, Jeff Moss |
RE: [xsl] How to put space between , Pieter Reint Siegers | Date | Re: [xsl] XHTML to XHTML transform, Jeff Moss |
Month |