xsl-list
[Top] [All Lists]

OR statement

2003-06-03 08:02:40
I'm transforming two (or more) RSS docs into one master xml that I'll be
using to display on our portal. I'm running into an issue where one of the
rss docs uses a date element called <dc:date> and another uses <pubdate>.
I'd like to transform them so that the final xml document uses only
<pubdate>. 

I've tried a couple of approaches:
<xsl:if test="(name() = pubdate or dc:date)">
    <xsl:variable name="cdate" select="name()"/>
    <xsl:element name="pubdate">
      <xsl:value-of select="$cdate"/>
   </xsl:element>
</xsl:if> 

And 

<xsl:choose>
    <xsl:when test="name() = pubdate">
        <xsl:element name="pubdate">
            <xsl:value-of select="node()"/>
        </xsl:element>
    </xsl:when>
    <xsl:when test="name() = dc:date">
        <xsl:element name="pubdate">
            <xsl:value-of select="node()"/>
        </xsl:element>
    </xsl:when>
    <xsl:otherwise></xsl:otherwise>
</xsl:choose>

And I'm not getting the desired results.

Anyone know how I can easily check if it's the <dc:date> or the <pubdate>
and tranform it to a <pubdate> if it's the <dc:date> (while inside a
<xsl:for-each>)?

Alan



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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