RE: [xsl] Get all childs with xsl:for-each

Subject: RE: [xsl] Get all childs with xsl:for-each
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 8 Feb 2005 12:44:37 -0000
> Why can't I get all <a> or <img> tags inside a relation when I use the
> above template?

Perhaps because of namespace declarations that you haven't shown us.

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


> 
> <my-relation name="relatedImages" type="image" multi="yes">
>               <td width="75%">
>                 <ul>
>                   <li>
>                   <a
> href="../images/autobahnraser.jpg">autobahnraser.jpg</a>
>                   <br /> 
> 
>                   </li>
>                 </ul>
>               </td>
> </my-relation>
> 			
> In my template where I match all <my-????> tags I have:
> 
> 				<xsl:when test="name(.) =
> 'my-relation'">
> 					<xsl:for-each
> select="descendant-or-self::a">
> 						<foo url="{@url}"/>
> 
> 					</xsl:for-each>
> 					<xsl:for-each
> select="descendant-or-self::img">
> 						<bar src="{@src}"/>
> 
> 					</xsl:for-each>
> 				</xsl:when>
> 
> And althoug there are <a> and <img> in my input XML I don't get any
> <foo> and <bar> in the output. What am I doing wrong?
> 
> R.

Current Thread