This way eliminates the global variables - it uses the document()
function istead.
Suppose you use two variables foo a bar, create small xml file vars.xml
<?xml version='1.0' encoding='iso-8859-6'?>
<vars>
<foo>foo value</foo>
<bar>bar value</bar>
</vars>
If you use file uri's in your templates, you may address you 'variables'
as document("vars.xml")/vars/foo etc. Yes, of course, it's quite verbose
method, but it works. :)
If you are using the AIP (C or Perl), you may use the named buffers as well.
Pavel
Martin Pedak wrote:
> Can and how can i deine toplevel variables with this kind of method -
> using one small xml file.
>
> I maked dynamic xml file with variables and values but how can i now
> define xsl variable values, wich i use inside of all my templates?
>
> Pavel Hlavnicka wrote:
>
>>
>> There is no way, how to determine the encoding of the passed-in string
>> value. There are some heristic methods, but generally (and especialy
>> for shorter strings) it is not possible to guess the encoding.
>>
>> You have to recode your values yourself. we're planning to publish
>> internal recoding functions used in the core engine, this should make
>> your life easier.
>>
>> Perhaps we could extend the API with a call like SablotAddParamEnc,
>> which could take a encoding identifier as additional parameter.
>>
>> Other way is to put all your params in one small XML file of any
>> necoding and use the document function to access them (as Petere
>> suggested in his message).
>>
>> Pavel
>>
>> Martin Pedak wrote:
>>
>>> That was i affraid of. And if the encoding is other than utf-8, if
>>> the encoding is like iso-8859-1 and i pass values like "����" then i
>>> get some weird chars, right ?
>>>
>>> So what is needed is that chars must be convertet to the utf-8 if it
>>> is not. Can you use iconv for this? Determine at first, in wich
>>> encoding string is and then encode it to utf-8 ?
>>>
>>> Pavel Hlavnicka wrote:
>>>
>>>>
>>>> utf-8
>>>>
>>>> sorry for the delay. Generally there is no other choice, I guess.
>>>> The first idea I had after reading your mail was, that parameter
>>>> could be processed in the same encoding as the stylesheed it is
>>>> refered from, but xsl:include disallows this approach.
>>>>
>>>> Pavel
>>>>
>>>> Martin Pedak wrote:
>>>>
>>>>> Hi.
>>>>>
>>>>> I posted some weeks ago one question where i asked about encodings
>>>>> of the parameters, but nobody answered...
>>>>>
>>>>> So question remains. In wich encoding sablotron reads parameters &
>>>>> parameter values?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>
--
Pavel Hlavnicka
Ginger Alliance
www.gingerall.com