xsl-list
[Top] [All Lists]

RE: [xsl] Descendant::??

2008-04-22 11:00:54
The working XSL-T:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
 <xsl:output encoding="UTF-8" method="html" version="4.01"
omit-xml-declaration="yes" media-type="text/html"/>
 <!-- value passed dynamically via asp -->
 <xsl:param name="paraCatagory"/>
 <xsl:template match="menu">
  <xsl:apply-templates
select="descendant::category[(_at_)name=$paraCatagory]"/>
 </xsl:template>
 <xsl:template match="category">
  <xsl:for-each select="child::category">
     <div class="cat_module">
      <xsl:value-of select="@display_name"/>
      <a href="{descendant::link}">
       <img src="{descendant::image}"/>
      </a>
      <xsl:value-of select="image"/>
     </div>
  </xsl:for-each>
 </xsl:template>
</xsl:stylesheet>

Critiques welcome, and thanks for all the help. 

-----Original Message-----
From: Dan Acuff [mailto:dacuff(_at_)suresource(_dot_)com] 
Sent: Tuesday, April 22, 2008 1:37 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Descendant::??

Ok thanks.

So far this is the closest I have gotten.

I have divs created 100% accuratly for each sub category AND the
@display_nane us getting displayed to boot. All acurate.

The only thing I need now is the default image to show up and the
anchor/link around it.

Here is the XSL:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
 <xsl:output encoding="UTF-8" method="html" version="4.01"
omit-xml-declaration="yes" media-type="text/html"/>
 <!-- value passed dynamically via asp -->  <xsl:param
name="paraCatagory"/>
 
 <xsl:template match="menu">
  <xsl:apply-templates
select="descendant::category[(_at_)name=$paraCatagory]"/>
 </xsl:template>
 
 <xsl:template match="category">
  <xsl:for-each select="category">
     <div class="cat_module">
      <xsl:value-of select="@display_name"/>
      <br/>
      <a href="{category/info/link}">
       <img src="{category/info/images/image}"/>
      </a>
     </div>
  </xsl:for-each>
 </xsl:template>
</xsl:stylesheet>

Is it possible to wrap the anchor code around another couple xsl:valu-of
commands?

Like <a href="{<xsl:value-of select"link"/>}"> etc. etc. ???
 

-----Original Message-----
From: Abel Braaksma [mailto:abel(_dot_)online(_at_)xs4all(_dot_)nl]
Sent: Tuesday, April 22, 2008 1:28 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Descendant::??

Dan,

In all your replies and examples you fail to show that you apply
xsl:apply-templates somewhere in your matching template. Hence, it can
only match once, because you instruct the processor *not* to continue.

Don't start trying difficult axes when you don't need to (sell, the
descendant axis is not difficult, but all you need is the default child
axis). Like I said in a previous post: try to keep it simple at first. 
Also, try the fully working example of David Carlisle sent in this
thread, four messages prior to this one (and answer his post, he took
the time to create a working example).

On a side note: keep the mail subject intact while in the same thread,
that is easier for the archive, which is collected per subject.

Kind regards,
-- Abel Braaksma

Dan Acuff wrote:
Do I want to use the Descendant predicate to get all nodeset children 
of the one I match on?

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
 <xsl:output encoding="UTF-8" method="html" version="4.01"
omit-xml-declaration="yes" media-type="text/html"/>
 <!-- value passed dynamically via asp -->  <xsl:param 
name="paraCatagory"/>
 
 <xsl:template match="menu">
  <xsl:apply-templates
select="descendant::category[(_at_)name=$paraCatagory]"/>
 </xsl:template>
 
 <xsl:template match="category">
     <div class="cat_module">
      <xsl:value-of select="category/@display_name"/>
      <br/>
      <a href="{category/info/link}">
       <img src="{category/info/images/image}"/>
      </a>
     </div>
 </xsl:template>
</xsl:stylesheet>

  


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