[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Jeff,
Try match="text()[parent::mynamespace:*]"
A text node isn't in a namespace, but its parent element may be. The predicate (bracketed expression) here filters out text nodes whose parent is not in the 'mynamespace' namespace (so the pattern matches only those whose parents are in it).
In general, where you have:
you could have
<xsl:template match="nbn:link">
<A HREF="{$controller}/module/{nbn-var:location/nbn-var:module}/action/{nbn-var:location/nbn-var:action}/" ID="{@id}" CLASS="menuitem">
<xsl:value-of select="@name"/>
</A>
<xsl:apply-templates/>
<BR/>
<xsl:apply-templates select="link"/>
</xsl:template>
... which is exactly the same, but put more concisely.
At 04:55 PM 4/2/2004, you wrote:
Re: [xsl] XHTML to XHTML transform
Subject: Re: [xsl] XHTML to XHTML transform From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 02 Apr 2004 17:24:06 -0500 |
Jeff,
Try match="text()[parent::mynamespace:*]"
A text node isn't in a namespace, but its parent element may be. The predicate (bracketed expression) here filters out text nodes whose parent is not in the 'mynamespace' namespace (so the pattern matches only those whose parents are in it).
In general, where you have:
<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>
you could have
<xsl:template match="nbn:link">
<A HREF="{$controller}/module/{nbn-var:location/nbn-var:module}/action/{nbn-var:location/nbn-var:action}/" ID="{@id}" CLASS="menuitem">
<xsl:value-of select="@name"/>
</A>
<xsl:apply-templates/>
<BR/>
<xsl:apply-templates select="link"/>
</xsl:template>
<xsl:template match="link"> <DIV CLASS="submenu"> <!-- plus whatever else happens to 'link'... apply-templates, copy or whatever --> </DIV> </xsl:template>
... which is exactly the same, but put more concisely.
Cheers, Wendell
At 04:55 PM 4/2/2004, you wrote:
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.
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XHTML to XHTML transform, Andreas L. Delmelle | Thread | RE: [xsl] XHTML to XHTML transform, Michael Kay |
RE: [xsl] XHTML to XHTML transform, Andreas L. Delmelle | Date | RE: [xsl] XHTML to XHTML transform, Michael Kay |
Month |
Keywords