Re: [xsl] XML Data Islands, XML Menu Trees and other stuff

Subject: Re: [xsl] XML Data Islands, XML Menu Trees and other stuff
From: António Mota <xptm@xxxxxxx>
Date: Tue, 7 Dec 2004 15:11:22 +0000
Well, i'm using Sarissa on the Javascript side and so far so good. The
problem
now is with XSL itself.

I'm trying to transform
http://gti.clientes.gtinformatica.pt/Site/Java/Menus.xml
with http://gti.clientes.gtinformatica.pt/Site/Java/dmenus.xsl . You can see
the result in http://gti.clientes.gtinformatica.pt/Site/Java/tap.html .

My problem is in this lines
		<xsl:variable name="position">
			<xsl:number level='any' count="menu"/>
		</xsl:variable>
(...)
		<xsl:if test="$position = $pos">
			<xsl:apply-templates select="menu"/>
		</xsl:if>

where pos is the position of the node "clicked".
They're working OK on the first level of menus, but not on the second. If i
click the 3 it expands correctly to 3.1 but 3.1 does not expand to 3.1.1 .

I've tryed lots of combinations, including using the parent:: node and all.
The
closest i can get is using

<xsl:if test="$position &lt;= $pos">

but than expands all the sub-menus, not the only one i want.

I also tryed position() instead of xsl:number, but no success.

Can someone help?

Thanks.

Citando Antsnio Mota <xptm@xxxxxxx>:

> Theres a sample in the package that seems a good starting point for what i
> need
> (or i think i need, at the moment...)
>
> Thanks a lot, i'll go dig it a little.
>
> Regards.
>
> Quoting Emmanouil Batsis <Emmanouil.Batsis@xxxxxxxxxxx>:
>
> >
> > Sarissa[1] may be what you are looking for and is available under
> > GPL/LGPL. The CVS version[2] has some new stuff that you might be
> > interested in that should make it easier to
> >
> > * apply the same stylesheet multiple times on XML documents using an
> > XSLTProcessor (since the previous version)
> > * inject the transformation result in the document using
> >
> > Sarissa.updateContentFromURI(sourceURL, targetElement, xsltProcessor)
> >
> > Feedback, especially on the CVS version very welcome.
> >
> > [1] http://sarissa.sf.net/
> > [2] http://cvs.sourceforge.net/viewcvs.py/sarissa/sarissa/
> >
> > hth,
> >
> > Manos
> >
> > xptm@xxxxxxx wrote:
> >
> > >I'm still playing around, but with limited succcess. I tryed to work
with
> > both
> > ><div> and <iframe> but they work diferently in IE / FF. I first used the
> div
> > >innerText but it seems it won't work with FF. Now, with the iframes it
> kinda
> > >work, but it still needs a lot of work.
> > >
> > >If you want to see a *very early* example look at
> > >http://gti.clientes.gtinformatica.pt/Site/java/menus.xml with the xsl in
> > >http://gti.clientes.gtinformatica.pt/Site/java/drawmenus.xsl but it's so
> > ugly
> > >i'm kind of embaressed...
> > >
> > >*OFF TOPIC* on other lists it was brought to my attention that it's not
> > polyte
> > >to sign posts with just a alias like "xptm", so just wanted to say that
my
> > name
> > >is Antsnio Mota, and i live near Lisbon, Portugal. I work with a lot of
> > things
> > >including Java and XSL, wich i like very much.
> > >
> > >One of the projects where i got much help from this list is in
> > >http://gti.clientes.gtinformatica.pt/Site/java/GTJDemo.html , it's a
> > pre-demo
> > >version, i hope i can put there a description of the XSLT work envolved.
> > >
> > >Best regards.
> > >
> > >
> > >
> > >
> > >Quoting xptm@xxxxxxx:
> > >
> > >
> > >
> > >>Wow, that looks great :)
> > >>
> > >>In the meantime i've been playing with the XmlHttpRequest and it really
> > works
> > >>on
> > >>IE and FF, at least. So it seems it's not dificult to get the XML files
> > >>without
> > >>a all trip to the server.
> > >>
> > >>Now for XSLTing the XML i think i'll wait for your example...
> > >>
> > >>Thanks a lot.
> > >>
> > >>Citando "M. David Peterson" <m.david@xxxxxxxxxx>:
> > >>
> > >>
> > >>
> > >>>xptm@xxxxxxx wrote:
> > >>>
> > >>>
> > >>>
> > >>>>Hi David, and all.
> > >>>>
> > >>>>OT i just went to XSLT:Blog and where it should appear (i added the
> > >>>>
> > >>>>
> > >>spaces)
> > >>
> > >>
> > >>>>I ' m
> > >>>>appears
> > >>>>I b $ (TM) m
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>Both IE and Firefox(and Im assuming other Mozilla based browsers) that
> > >>>are set to auto detect encoding decide that utf-8 is actually
> > >>>iso-8859-1.  Given that they both do it my assumption is that there is
> > >>>some obscure line in the HTML causing this to happen as I find it
> > >>>strange that both algorithms would read the byte stream in the same
way
> > >>>and determine iso-8859-1 instead of the proper utf-8.  The charset is
> > >>>clearly defined as utf-8
> > >>>
> > >>><meta snip... content="text/html; charset=utf-8" />
> > >>>
> > >>>So I really dont know whats up...  I cant be the only MT install that
> has
> > >>>this problem so as soon as I have a chance I will look further into
it.
> > >>>
> > >>>In the mean time manually change your browser to recognize the page as
> > >>>
> > >>>
> > >>UTF-8
> > >>
> > >>
> > >>>and youll be fine, all be it temporary.
> > >>>
> > >>>
> > >>>
> > >>>>Now on-topic, i've been searching for info in places like w3schools,
> and
> > >>>>
> > >>>>
> > >>it
> > >>
> > >>
> > >>>>gives me the impression that XML data islands and related techniques
> are
> > >>>>
> > >>>>
> > >>>very
> > >>>
> > >>>
> > >>>>tyied to IE browser, like HTML elements binding, XML HTTP requests,
> > etc...
> > >>>>
> > >>>>
> > >>>Also
> > >>>
> > >>>
> > >>>>i saw that XML data islands has nothing to do with W3C...
> > >>>>
> > >>>>Is this correct?
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>No... It does take some trickery but its possible and really quite
easy
> > >>>once you understand the process that needs to take place.
> > >>>
> > >>>
> > >>>
> > >>>>My boss suddenly give a high priority to this going-to-be project, so
> let
> > >>>>
> > >>>>
> > >>me
> > >>
> > >>
> > >>>>elaborate a little more for you to see if this falls in your
> techniques.
> > >>>>
> > >>>>Do you think you techniques can be adaptable to this, or should i
start
> > >>>>
> > >>>>
> > >>>looking
> > >>>
> > >>>
> > >>>>elsewere?
> > >>>>
> > >>>>Regards.
> > >>>>
> > >>>>Basically, my intention is to have a menu tree that, when cliked on a
> > >>>>
> > >>>>
> > >>node,
> > >>
> > >>
> > >>>>would do a trip to the server to get some XML that could be a
sub-menu
> > >>>>definition to display dinamically, or a XML ResultSet from a db to
> > display
> > >>>>
> > >>>>
> > >>>via
> > >>>
> > >>>
> > >>>>XSL/CSS/CSS2, or even a HTML page to display on a frame (altougt i
> don't
> > >>>>
> > >>>>
> > >>>like
> > >>>
> > >>>
> > >>>>frames). I want to do this dinamically, specially without refreshing
> the
> > >>>>browser, as this has a tendency to become very heavy.
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>In fact this a perfect example of how this could be used...  In fact
> > >>>that would be a simple demo to quickly create... instead of stressing
> > >>>over this larger piece let me feed it to you in bit size morsels as it
> > >>>will probably be easier to understand initially and from there is just
> > >>>adding one more source of data at a time and using that data to
> > >>>coordinate proper context between the elements between rendered...
> > >>>
> > >>>Give me a bit to rethink how best to showcase this and I will return
> > >>>with a sample...
> > >>>
> > >>>
> > >>>Cheers!
> > >>>
> > >>><M:D/>
> >
> >
>
>
>
>
>
> O SAPO ja esta livre de vmrus com a Panda Software, fique vocj tambim!
> Clique em: http://antivirus.sapo.pt
>
>





O SAPO ja esta livre de vmrus com a Panda Software, fique vocj tambim!
Clique em: http://antivirus.sapo.pt

Current Thread