<br><div class="gmail_quote">On Sat, Dec 26, 2009 at 9:43 PM, Nevo <span dir="ltr"><<a href="mailto:sakur.deagod@gmail.com">sakur.deagod@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
hi, <br>
Sorry, forgive me not able to clarify more on this topic . Here's the
piece of code from the Genshi template file :<br>
<py:match path="body" once="true" buffer="false"><body><br>
${select('*|text()')}<br>
</body> </py:match><br>
<br>
The above code is just instructing the template engine to *select*
the text content of node "body" from the XHTML streams. That's the one
I was asking actually. There's a difference between Genshi and PLT
scheme web template from my point of view , the former separates the
template macros and the real content streams ,while the latter
combines the template macros (S-expressions) with the content. As
suggested by Jay, I could use SXML/SXPATH library to parse the XHTML
content and select those nodes which I'm interested in. Yeah, this is
possible , but I havn't used that yet, on a quick read of its tutorial
(<a href="http://modis.ispras.ru/Lizorkin/sxml-tutorial.html" target="_blank">http://modis.ispras.ru/Lizorkin/sxml-tutorial.html</a>) , I probably need
to obtain a SXML representation of a document which means the template
file should be expanded first (using @include-template) and then parse
it using SXML parser into a SXML document before I can use SXPath on
it, am I right ? Or is there a way to do it in template file itself ?
Thanks.<br></div></blockquote><div><br>You need to convert the xml string generated by include-template into sxml in order to use sxpath, i.e., <br><br>(require (planet lizorkin/sxml) (planet lizorkin/ssax/ssax) web-server/templates) <br>
((sxpath ...) (ssax:xml->sxml (open-input-string ((include-template "template.html") ...)))) <br><br>Cheers,<br>yc<br></div></div>