Section numbering using xmerl:export
Vlad Dumitrescu
vlad_dumitrescu@REDACTED
Fri Aug 30 12:44:51 CEST 2002
Thanks Ulf,
Yes, what you say is about what I'd had figured. The cornerstone is that I
sometimes need to replace an element with a mixed content, which I couldn't
see how to use xmerl:export for. [I am implementing Zope´s template
language, hope it'll be ready for a preview real soon]
Maybe my traverse function will make it to the xmerl distribution after all
:-)
regards,
Vlad
----- Original Message -----
From: "Ulf Wiger" <etxuwig@REDACTED>
To: "Vlad Dumitrescu" <vlad_dumitrescu@REDACTED>
Cc: <erlang-questions@REDACTED>
Sent: Friday, August 30, 2002 10:51 AM
Subject: Re: Section numbering using xmerl:export
> On Fri, 30 Aug 2002, Vlad Dumitrescu wrote:
>
> >>From: "Mikael Karlsson" <mikael.karlsson@REDACTED>
> >>
> >>Thanks for the reply and code Vlad,
> >>as far as I understand the xmerl:export(Data, Callback) does the similar
> >>as your example, but that instead of a fun you provide a Callback
> >>module which implement every tag you want to transform as a function:
> >
> >Hi,
> >
> >I wrote that function just because I thought export wouldn't
> >give me what I needed, but it is possible that I didn't dig deep
> >enough into xmerl...
> >
> >I hope Ulf or Richard can confirm if I'm right or wrong: can
> >xmerl:export be used to return another XML structure too? The
> >examples only return text representing the XML or HTML, so I
> >might have been mislead into thinking that this is all
> >xmerl:export can do...
>
> Well, it's not that easy, but what you can do is to use the
> return value {'#xml-redefine#', NewData} from your callback.
> NewData can be a new xmerl structure that replaces the old. Xmerl
> will then call the export callbacks with the new structure
> instead of the old one. This could of course be used for
> re-ordering and such, but I would try not to go overboard with
> it.
>
> There is also the {'#xml-alias#', NewTag} that allows for
> synonyms, e.g.
>
> section(Data,Attrs,[{section,A},{section,B},{section,C}|_],E) ->
> {'#xml-alias#', h4};
> section(Data,Attrs,[{section,A},{section,B}|_],E) ->
> {'#xml-alias#', h3};
> section(Data,Attrs,[{section,A}|_],E) ->
> {'#xml-alias#', h2};
> section(Data,Attrs,_,E) ->
> {'#xml-alias#', h1}.
>
>
> /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