XSLT

Jasper Huijsmans jasper at moongroup.com
Fri Aug 8 13:58:23 CEST 2003


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
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 ;)

If you have all information I would consider writing it from the perl
data structure directly to xfce4rc style xml.

The information you need is

general: number of items (this important! includes clock and
pager/switcher), size, I would not do position, since it will be wrong
anyway (panel will have different size)

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

The launcher type is most common. It needs icon, command, caption (only
for menu items) and optionally tooltip.

Others are clock, mailcheck, pager or desktop switcher. They are defined
by their library name (e.g. <Control id="-1" filename="libclock.so"/>)

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.

Hope this helps,
	
	Jasper




More information about the Xfce4-dev mailing list