Section numbering using xmerl:export

Ulf Wiger etxuwig@REDACTED
Fri Aug 30 09:25:15 CEST 2002


On Thu, 29 Aug 2002, Mikael Karlsson wrote:

>Hmm,
>This sounds interesting,
>would this also mean that one could perform XSL-type operations like
>having an arbitrary order of rearranging/filtering the transformed
>elements, like making a contents table, etc. As it is now it seems that
>you have to maintain the input XML document order in the export.
>
>/Mikael

You can of course do this by hand without too much erlang
programming. That was ultimately the reason why I quit trying to
implement XSL in xmerl (the fact that it is bloody difficult to
implement XSL efficiently was a contributing factor, of course.)

A good first step would perhaps be to export the functionality in
xmerl_xpath that prepares the XML document for the XPATH search,
and perhaps some of the search functions as well. Then you could
write your own XSL-like Erlang module with "relative ease".

/Uffe

>torsdag 29 augusti 2002 18:07 skrev Ulf Wiger:
>..
>> One idea would be to modify the export concept to do something
>> similar to xmerl_xpath. I had thought about doing this to make
>> XSL-type operations possible via the export API. The trick used
>> by xmerl_xpath is to put the full parent element in the parents
>> list instead of just the {Tag, Position} indicator.
>>
>> This might seem expensive from a memory consumption point of
>> view, but it is in fact just a pointer to the element behind the
>> scenes. This would allow the tag function to freely inspect its
>> parent or its siblings. In your case, you could go via the parent
>> element and look at the preceding siblings, counting the
>> occurences of 'section' elements.
>>
>> If this appeals to the rest of you, I could prototype such a
>> modification. I don't know how much of an issue backwards
>> compatibility is for xmerl...?
>>
>> /Uffe
>
>

-- 
Ulf Wiger, Senior Specialist,
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson Telecom AB, ATM Multiservice Networks




More information about the erlang-questions mailing list