hi Jay:<br> Thanks for your kind suggestion and explanation. I myself have a happy time to play with PLT template system just ,you know, still need more practice to get into it. The difference between Plt template and Genshi template is not my concern. Actually I'm trying to translate the Trac template (particular fullblog plugin) to PLT web, and seeing those XPath related syntax everywhere in Genshi template files , so just wondering if a similar syntax would be supported in PLT template. Now I have more sense (compared to my previous usage) about how to deal with PLT template , it's handy to treat PLT template as a Scheme program with simple syntax as pointed out by you, compared with that traditional template engine like Genshi (read, parse, expand, generate). That's great!<br>
Btw, sorry , I have another (maybe non sense) question that, for example, I now have a template file piece like follows:<br> <XHTML><br> .....<br> @select-node["content/title/title1/text()"]<br> .....<br>
</XHTML><br><br> and "select-node" is defined in another scheme file:<br> (define (select-node xpath-textual)<br> (let ((q1 (sxpath xpath-textual)))<br> (q1 current-xml-template)))<br><br> and "current-xml-template" is a SXML document representation of :<br>
<content><br> ...<br> <title><br> <title1> @get-page-1-title[]</title><br> ....<br> </title><br> ...<br> </content><br><br> As you probably see , the @select-node will produce just "@get-page-1-title[]" , so is it possible to let template compiler to recompile the produced stream second pass so that @get-page-1-title[] will also be got expanded ? I knew this question may sound no sense and not a problem at all ( I could simply call @get-page-1-title in template instead of bothering SXPATH at all), just a silly question though.<br>
<br>Nevo<br><br><div class="gmail_quote">2009/12/29 Jay McCarthy <span dir="ltr"><<a href="mailto:jay.mccarthy@gmail.com" target="_blank">jay.mccarthy@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I think the difference you're getting at is that because the PLT<br>
template system is more powerful, there is less that you can do with<br>
it externally. The PLT templates are not necessarily XML, so it<br>
doesn't make sense to parse them and analyze them as if they were. PLT<br>
templates are simple Scheme programs that when run produce the text<br>
you want, but they have a convenient syntax (thanks to Eli primarily)<br>
for primarily text documents.<br>
<br>
If you wanted you could enforce upon yourself the restriction that<br>
your templates were actually XML and parse them, but I'm still not<br>
sure what you feel that that (or Genshi) would do for you.<br>
<br>
Jay<br>
<br>
On Sat, Dec 26, 2009 at 10:43 PM, Nevo <<a href="mailto:sakur.deagod@gmail.com" target="_blank">sakur.deagod@gmail.com</a>> wrote:<br>
> hi,<br>
<div><div></div><div>> Sorry, forgive me not able to clarify more on this topic . Here's the<br>
> 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<br>
> text content of node "body" from the XHTML streams. That's the one I was<br>
> asking actually. There's a difference between Genshi and PLT scheme web<br>
> template from my point of view , the former separates the template macros<br>
> and the real content streams ,while the latter combines the template macros<br>
> (S-expressions) with the content. As suggested by Jay, I could use<br>
> SXML/SXPATH library to parse the XHTML content and select those nodes which<br>
> I'm interested in. Yeah, this is possible , but I havn't used that yet, on<br>
> a quick read of its tutorial<br>
> (<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<br>
> obtain a SXML representation of a document which means the template file<br>
> should be expanded first (using @include-template) and then parse it using<br>
> SXML parser into a SXML document before I can use SXPath on it, am I right ?<br>
> Or is there a way to do it in template file itself ? Thanks.<br>
><br>
> Nevo<br>
><br>
><br>
> Actually, I think you misunderstood.<br>
><br>
> Tell us what you want and it may be pretty easy to do.<br>
><br>
> On Sat, Dec 26, 2009 at 11:28 PM, Nevo <<a href="mailto:sakur.deagod@gmail.com" target="_blank">sakur.deagod@gmail.com</a>> wrote:<br>
><br>
><br>
> hi Todd:<br>
> Yeah... your words sound like a style of education to me but useful<br>
> (really appreciate) . Of course I will take the stabs at writing pieces of<br>
> prototype and ask here for review. As currently I'm still on the way to<br>
> fully understand and practice with the powerful PLT scheme web framework by<br>
> means of building up my blog service , the quick follow up in this topic is<br>
> just a curious wonder and hope not offending the underlying laws of this<br>
> mailing list. I really want to contribute to this great community and be<br>
> able to help others in exchange to the huge helps from here, but as you know<br>
> my numb brain just tells me you should dig in it before you give any output<br>
> ,as emphasized by you. So thanks anyway , I'll see what I would help in the<br>
> future.<br>
><br>
> Nevo<br>
><br>
> On Sat, Dec 26, 2009 at 10:12 PM, Nevo <<a href="mailto:sakur.deagod@gmail.com" target="_blank">sakur.deagod@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> Yes, it's pretty useful and enjoyable to do web programming in plt scheme.<br>
> But I just wonder any plan to continue to extend the powerness of Plt scheme<br>
> web framework ? Like provide XPath select support in current HTML template<br>
> system which I've been using in Genshi ( a python template component used<br>
> in Trac (<a href="http://trac.edgewall.org" target="_blank">trac.edgewall.org</a>) ? thanks .<br>
><br>
> Nevo<br>
><br>
><br>
><br>
> Assuming it works the way most other development in PLT has seemed to<br>
> work, here's all you need to do:<br>
><br>
> Step 1. Find a student who wants a Master's or Ph.D. in Computer Science.<br>
><br>
> Step 2. Interest him/her in what you want.<br>
><br>
> Step 3. Get him/her to interest a member of the PLT group as an advisor.<br>
><br>
> Step 4. Wait for the goodies. :-)<br>
><br>
> But seriously, I'm working with some of my (high school) students on a<br>
> couple of PLT web apps and we're seeing things we wish we had and<br>
> taking stabs at putting them together. If you can give examples of the<br>
> kind of functionality you want and take stabs at writing parts of the<br>
> code, this mailing list is incredibly good about helping you along.<br>
><br>
> As someone who's gotten huge amounts of help on this list in exchange<br>
> for a mere pittance of very basic help for the few people even more<br>
> clueless than himself, my suggestion is dig in, start writing, ask for<br>
> help, and before you know it, you'll have what you always wanted.<br>
><br>
> Todd<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
<br>
<br>
<br>
</div></div><div><div></div><div>--<br>
Jay McCarthy <<a href="mailto:jay@cs.byu.edu" target="_blank">jay@cs.byu.edu</a>><br>
Assistant Professor / Brigham Young University<br>
<a href="http://teammccarthy.org/jay" target="_blank">http://teammccarthy.org/jay</a><br>
<br>
"The glory of God is Intelligence" - D&C 93<br>
</div></div></blockquote></div><br>