xsl-list
[Top] [All Lists]

Re: [xsl] Need Help

2006-12-08 17:12:10
Sorry, I am new to this and just happened to come across the site.  I will do a 
little reading.  I thought you could pass parameters into the xslt and use it 
within conditional statments.  I guess I was wrong.  Thanks for the help I will 
just keep tring to put something together that meets my needs.  If anyone else 
has any other ideas about this your help would be appreciated.  

Charles Knell seemed to think that it was possible but I am not as wise as him 
so I don't know if it is.

Brant

----- Original Message ----
From: David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Sent: Friday, December 8, 2006 3:55:40 PM
Subject: Re: [xsl] Need Help


(please see the list posting guidelines about choosing subject lines
that help the archives later)


I want to transform it to this
..
Is this possible?  

not exactly as your requested format isn't well formed (<a> elements not
closed) but  essentially I suspect you want something like

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";;>
<xsl:output indent="yes"/>
<xsl:template match="menu">
  <ul>
    <xsl:apply-templates/>
  </ul>
</xsl:template>
<xsl:template match="item">
  <li>
    <a href="{(_at_)url}"><xsl:value-of select="@title"/></a>
    <xsl:if test="item">
      <ul>
      <xsl:apply-templates/>
      </ul>
    </xsl:if>
  </li>
</xsl:template>


</xsl:stylesheet>

which produces

<ul>
   <li>
      <a href="#">Home</a>
   </li>
   <li>
      <a href="#">My Stuff</a>
      <ul>
         <li>
            <a href="#">Backgrounds</a>
         </li>
         <li>
            <a href="#">Flyers</a>
         </li>
        <li>
            <a href="#">Posters</a>
         </li>
      </ul>
   </li>
   <li>
      <a href="#">Portfolio</a>
      <ul>
         <li>
            <a href="#">Backgrounds</a>
         </li>
         <li>
            <a href="#">Flyers</a>
         </li>
         <li>
            <a href="#">Posters</a>
         </li>
         <li>
            <a href="#">More Information</a>
            <ul>
          </li>
               <li>
                  <a href="#">Contact Me</a>
               </li>
            </ul>
         </li>
      </ul>
   </li>
</ul>


Also I would like to apply CSS Classes to certain nodes depending if
they are selected or not.

selected by what, where?


  And can I hide child nodes if the p=arent node is not selected?

xslt doesn't interact with the browser at all (even if you are using a
client side xslt that's in the browser) it just generates an html page
that is then rendered, so if you know what css and/or javascript you
need to get whatever dynamic effect that you want, then you can generate
that code in xslt, but xslt doesn't "know" anyting about css or
javascript (or html) it's just generating an element tree, and the
javascript is just text as fas as xslt is concerned.

David

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


 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.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>