xsl-list
[Top] [All Lists]

FW: Confused by xsl:for-each

2004-11-25 05:56:58
Hi,
  Apologies

<xsl:template match="/">
        <foo>
                <xsl:apply-templates select="//relation"/>
        </foo>
</xsl:template>

regards
Manpreet

-----Original Message-----
From: Manpreet Singh [mailto:singhm(_at_)quark(_dot_)co(_dot_)in]
Sent: Thursday, November 25, 2004 6:25 PM
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: RE: [xsl] Confused by xsl:for-each
Importance: High


Hi,

  if you want only the <a> tags in your output without its attributes and
text node then you should be using xsl:copy and not xsl:copy-of.
  Else if you want <a>'s attr's and text then what you  are doing is
correct. Just put a root tag for the target document as below.

<xsl:template match="/">
        <foo>
                <xsl:apply-templates select="relation"/>
        </foo>
</xsl:template>

<xsl:template match="relation"> <!-- match is fine-->
        <xsl:for-each select="//a">
                <xsl:copy-of select="."/>
        </xsl:for-each>
</xsl:template>

Regards
Manpreet Singh

-----Original Message-----
From: Robert Soesemann [mailto:rsoesemann(_at_)sapient(_dot_)com]
Sent: Thursday, November 25, 2004 6:17 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Confused by xsl:for-each


Hello, 

I am a bit confused how/why I can't get for-each to work here.

Input:

...
<tr>
  <relation name="relatedAddress" type="address">
    <td>
      <a href="external/address.html">Adresse 1</a><br />
      <a href="error/code.html">Adresse 2</a>
    </td>
  </relation>
</tr>
...

From <relation> occurences I want to copy only all HTML a tags to the
output document.
I try this with. Not successfully ;-). I get no copied <a..> tags.

<xsl:template match="relation"> <-- match is fine
        <xsl:for-each select="//a">
                <xsl:copy-of select="."/>
        </xsl:for-each>
</xsl:template>

Thanks for assistence,

Robert

--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>