xsl-list
[Top] [All Lists]

RE: [xsl] Namespaces.

2006-03-31 01:31:47
Just replace 

    <xsl:if test="count(*) = 0">
      <xsl:value-of select="."/>
    </xsl:if>
    <xsl:apply-templates name="child::*"/>

by

<xsl:apply-templates/>

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Kamal Bhatt [mailto:kbhatt(_at_)tt(_dot_)com(_dot_)au] 
Sent: 31 March 2006 01:57
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Namespaces.


Apologies, this message took a long time to get to the server, so I 
already found a solution:

<xsl:template match="node()">
  <xsl:element name="local-name()">
    <xsl:apply-templates select="@*"/>
    <xsl:if test="count(*) = 0">
      <xsl:value-of select="."/>
    </xsl:if>
    <xsl:apply-templates name="child::*"/>
   </xsl:element>
</xsl:template>

<xsl:template match="@*">
  <xsl:attribute name="{name()}">
    <xsl:value-of select="."/>
  </xsl:attribute>
</xsl:template>

One thing I don't like about this is it assumes that you 
won't have stuff like this:

<kamal>this is a <bold>message</bold></kamal>

In this case, it is not necessary, but I would like to know 
if there is anyway of avoiding this?

Cheers.

Kamal.



--
Disclaimer: This email is confidential and may contain 
privileged information for the sole use of the person or 
business to which it is addressed. If you are not the 
intended recipient, please notify the sender by return e-mail 
or phone as you must not view, disseminate, distribute or 
copy this email without our consent. We do not accept any 
liability in connection with any computer virus, data 
corruption, incompleteness, or unauthorised amendment of this 
email. It is the sole responsibility of the receiver to scan 
for viruses before opening.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>