xsl-list
[Top] [All Lists]

RE: Confused by xsl:for-each

2004-11-25 06:36:37
Hi,

Although you say this should work, it does not. The select="//a" seems
not to work.
When I write

<xsl:value-of select="number(.)"/> I get 1 for one td
BUT <xsl:value-of select="number(//a) I get 0, although there are two
<a..> inside <td>.

Whats wrong here.

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


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


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