XSLT
Ric
fhj52ads at yahoo.com
Fri Aug 8 18:39:26 CEST 2003
Hi:
--- Jasper Huijsmans <jasper at moongroup.com> wrote:
> Op vr 08-08-2003, om 13:31 schreef Matthew Weier OPhinney:
> > -- Biju Chacko <biju_chacko at vsnl.net> wrote
> > (on Friday, 08 August 2003, 12:09 PM +0530):
> > > On Thu, 07 Aug 2003 23:11:46 -0700 (PDT), Ric wrote:
> > > >
> > > > Will somebody give me a heads-up on how y'all get the XML files
> > > > into the format that you want? Who's the XSL/XSLT guru here?
> > >
> > > Frankly, since the old format doesn't really map to the new
> > > format very well I'm not sure how to do this.
> > >
> > > I haven't really looked at the problem, but I would use perl to
> > > parse the old file into a hash and write the appropriate
> > > values into a template of the current format.
> >
> > Right, he's already done that part. I think what Ric's getting at
> > is that he wants to merge the xfce4rc XML he's generated from
parsing
> > the xfce3rc file with an existing xfce4rc file. And he wants to
make
> > absolutely sure he does that _last_ part correctly. Hence the
> > XSL/XSLT questions.
>
> Well, the xml code shown in ric's example is definitely not xfce4rc
> style. As a side note, there is no dtd, nor a xslt script, it's just
^^^^^^^^^^^^^^^
:( bummer.
Oh well, at least you made the structure simple.:)
> tags invented by me to obtain a structured tree for the config data
> that can be parsed and writen by libxml. Oh, and don't merge with
> anything, just create a new file. That will save you a lot of
problems ;)
Okay; Probably can just make a new file based on the default.
> If you have all information I would consider writing it from
^^^
idunno; maybe. :) I'm working on it...
> the perl data structure directly to xfce4rc style xml.
?
Matthew, Joe do you know what he is talking about? All, AFAIK, that is
needed, at this point, is to take output.xml tags & content and put
them in
the correct spots with the correct xfce4rc tag names. It is more of a
sorting
job and then a transform to the new tag name with content.
Then, some contents of tags need to be changed and some conditionals
added to complete the task.
-can y'all do that easily with Perl-XML-XSLT or perl-XML-LibXSLT
or is that a monster task?
> The information you need is
>
> general: number of items (this important! includes clock and
The exact number cannot be calculated before the user xfce3rc file is
parsed but whatever is in [Popups] gets ~ 7 added to it for the clock,
separators, etc.
That [Popups] number is in the Output.xml file as:
<Panel_orientation>
<groups>12</groups>
</Panel_orientation>
> pager/switcher), size, I would not do position, since it will be
> wrong anyway (panel will have different size)
The y position should be done to determine if it is Top or Bottom;
the x coordinate could be an interpolated value. However, maybe
just setting x to 0 would be ok, too. Certainly easier. I like easy.
:)
> for each item:
> type of item
> item data : different for each type <-- this is probably difficult to
> automate. You have to make a special case function for each type.
> with submenu : yes or no
> submenu data: launcher items
I have that coded into the XML tag:
<Group_Control_Commands>
^^^^^
means tag for <Control id blah>
<Command> </Command>
<Command-Group1>xfclock</Command-Group1>
^^^^^
means tag goes into the first Group( relative to the additional
default groups)
<Command-Group12>xcalc -geometry -0+52</Command-Group12>
^^^^^
means tag goes into the twelfth Group which is relative to the
additional default groups of Xfce Clock, separator, etc. so it would
actually be the ~ 20th 'Group' position in the xfce4rc file if clock,
mailcheck, a few separators and the switcher or pager are included as
they s/b.
And, BTW, it could be automated at all. The txt2XML "rules" do not have
the constructs for looping and incrementing, etc.
> The launcher type is most common. It needs icon, command, caption
> (only for menu items) and optionally tooltip.
Those are coded in the OUTPUT.xml also as
<Group#>
<caption-popup#-item##>
<icon-popup#-item##>
<command-popup#-item##>
</Group#>
but tooltip will either be empty or just have the command(as in
XFce3).
I lean toward empty since it is easier but having the tooltip as the
command, initially, would make it more XFce3-like.
> Others are clock, mailcheck, pager or desktop switcher. They are
> defined by their library name (e.g. <Control id="-1"
> filename="libclock.so"/>)
Just as you have it in the default file. Except, for consistency,
clock would be on the left(at the top of the Groups) and
libsystembuttons.so would be on both sides
of the pager/switcher with separators.
> General format:
> <?xml version="1.0"?>
> <Xfce>
> <Panel/>
> <Groups>
> <Group>
> <Popup>
> <Item></Item>
> ...
> </Popup>
> <Control></Control>
> </Group>
> ...
> </Groups>
> </Xfce>
>
> Look at the default config file for more specific examples.
Yes. I did and that's what I surmised. Will look again, too.(and
again, and agin...:).
> Hope this helps,
Yes. Thank you. I appreciate you taking the time to explain. It helps
to verify what I guesstimated was true and gave me some good advice on
some pitfalls to avoid. That's a really good thing.
> Jasper
Currently, the txt2XML perl program from NASA ADC* and my rules.xml
file will produce XML from the ~/.xfce/xfce3rc file(non-destructively)
which can be transformed into a different XML format or even another
Markup Language. That's supposed to be XSL's thing and it should be
quite straight forward. I hope so ...
I have tested the "rules" with as many different well-formed xfce3rc
files that I can here. I have been using 3.16 for quite a while but
built 3.18 and will test it with it too, soon(I do not know if there is
any difference -i hope not!). Of course, anybody is welcome to the
xfce324_rules.xml file for testing/usage(it's only ~75kB).
/me going to look at the inside of my eyelids and then, later, XSL some
more...
*National Aeronautics Space Administration Astronomical Data Center -
it is GPL'd, too
=====
Have A Great Day!
Ric
***
Mondale knew this was gonna be a bad day when he called
Dial-a-Prayer and the taped message answered him by name.
-- Bob Hope, 1903-2003
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
More information about the Xfce4-dev
mailing list