Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] XHTML to XHTML transform

From: "Jeffrey Moss" <jeff@------------>
To:
Date: 4/2/2004 11:56:00 AM
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>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent