One more ques Re: [XML-SIG] I am confused...

Roman Suzi rnd@onego.ru
Mon, 29 Jan 2001 16:33:26 +0300 (MSK)


On Sun, 28 Jan 2001, Mike Olson wrote:

And one more problem: my texts are far from plain ASCII.
Do I need to convert them to utf8 or unicode before
working with XML+XSLT+XPath?
Do I need Python-2 to implement non US-ASCII site (and not latin-1)?

>Roman Suzi wrote:

I must admit I never had clearer answers for my
questions as in this list! Even though I formulated my
problem poorly, I received well-targeted answers
which will help me tailor solution to my problem.

>> In my application I need many such queries to fill
>> the template - that is why speed was unbearable.
>
>What is you template?  XSLT?  If not have you thought of using it.  It
>sounds like it was designed to do exactly what you need.

My templates are just fiels with %(var)s -style things inside.
And thank you mentioning XSLT with referring to
working site - I will see if this fit in my case.

>> Please, tell me if I did it wrong:
>>
>> - parsed xml-file
>> - quered each variable in a template-file from the xml-file
>> - filled template with values found to produce web-page
>>   (some variables go to other pages, for example, content page)
>
>Again, it sounds like your doing a lot by hand that is not needed.  You
>can do this in XSLT with a simple template like

><xsl:template match='article'>
>  <HTML><HEAD><TITLE>Article By <xsl:value-of
>select='author/name'/></TITLE></HEAD></HTML>
></xsl:template>

Wow! If it works as advertized - this is what I need.

Can I also embed some python sentences there to handle
hard cases?


>The big advantage is that all of your XPath expressions can be relative
>to the current context.  In the above example, the current context is
>already the article so you don't need to match on it again.
>>
>> I am trying to learn XML for 2 years already but am
>> still a newbie in practice.
>>
>> Anyway, before claiming XML tools for Python slow I need to recheck
>> with new versions - if there are no objections to the
>> above scheme. (And what is preferrable tool for queries?
>> XPath?)
>
>I'd definitly upgrade to latest versions.

I did it already.

>I'd also consider XSLT.

>From what you have shown - sure.

>> Is there any on-line tutorial (?) or just example code
>> to learn how to work efficiently with XML from Python?
>> (Python is my favorite language while Java is not)
>> I read code from xml.* but it doesn't give me clues
>> for real usage.
>
>Were working on them.  There are some demos that come with the code, but
>no real beginners tutorial.

Demos are sometimes more valuable than tutorials.
In fact, I feel a need to reread overviews on XML (XSLT, XPath, AFs etc)
to have better idea what they do before looking at
demos.

>Hope this helps,
>
>Mike

Sincerely yours, Roman Suzi
-- 
Vote for my design: http://silvermouse.onego.ru/gray.php3?id=0018
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd@onego.ru _/
_/ Monday, January 29, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "The tuna doesn't taste the same without the dolphin." _/