ois
Posts: 39
Joined: Sun Mar 19, 2006 1:52 pm

Postby ois » Sat Jun 02, 2007 12:23 pm

How can I do this? - I want to alphabetically sort a workpad so that when i generate an xml report it is in alphabetical order.

(i am using advanced 2.3)

2 not 100% successful ways that i have tried are:

1. doing an xslt sort -but this only sorts the appearance not the original file.
2. using the report as the basis for a new channel, sorting the items in the new channel and then adding them all to a new workpad and finally exporting that - however, i want to do this every day and it takes AWASU a couple of days to forget the archived items in this new channel even though the channel is set to archive items for 1 day (minimum allowable)...

Is there a way to sort workpads or is there a way to make my new channel never archive anything?


thanks!

User avatar
support
Site Admin
Posts: 3021
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Sun Jun 03, 2007 4:42 am

ois wrote:1. doing an xslt sort -but this only sorts the appearance not the original file.

Can't you just pipe the XSLT output to another file?

What are you trying to do? It seems like you just want a list of items in a workpad, but sorted.

ois
Posts: 39
Joined: Sun Mar 19, 2006 1:52 pm

Postby ois » Sun Jun 03, 2007 11:32 am

I'm trying to get an xml file that contains links to news stories, none of which are repeated.

One of the nice features of the workpads is that they won't let you add the same link twice. However, if the the link comes from another source, eg you get the same article from a google channel and a yahoo channel, then it'll happen. Alphabetically sorting will catch this sort of thing.

Are you suggesting using xslt to generate a sorted html page which looks like an xml file. Opening it in a browser and then copying and paste it back into an xml file? Or have you got a more automagic solution up your sleeve?

:)

User avatar
support
Site Admin
Posts: 3021
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Mon Jun 04, 2007 5:08 am

ois wrote:Are you suggesting using xslt to generate a sorted html page which looks like an xml file. Opening it in a browser and then copying and paste it back into an xml file?

Wow, that's kinda convoluted :blink: Why don't you just get the XSLT to generate XML output?

ois
Posts: 39
Joined: Sun Mar 19, 2006 1:52 pm

Postby ois » Mon Jun 04, 2007 10:12 am

Wow, that's kinda convoluted Blink Why don't you just get the XSLT to generate XML output?


'cos i don't know how! :oops:

User avatar
support
Site Admin
Posts: 3021
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Mon Jun 04, 2007 11:34 am

ois wrote:'cos i don't know how! :oops:

But you've got an XSLT already generating HTML output, right?

I'm no XSLT guru but if you squint at it just right, it should be possible to see how to tweak it to generate XML instead.

ois
Posts: 39
Joined: Sun Mar 19, 2006 1:52 pm

Postby ois » Mon Jun 04, 2007 12:44 pm

i'm no guru either
my problem with this method/my scant knowledge is that the xsl only changes the appearance of the file

I can get xsl to format my original xml file to look like a sorted xml in a browser ( as previously mentioned) but I don't know a quick way to make it create a new sorted file.

Ideas anyone?

What about my other method? Is it possible to make awasu not archive a particular channel? Or delete the archive for that channel only?

Thanks!

User avatar
support
Site Admin
Posts: 3021
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Mon Jun 04, 2007 1:00 pm

ois wrote:I can get xsl to format my original xml file to look like a sorted xml in a browser ( as previously mentioned) but I don't know a quick way to make it create a new sorted file.

How are you actually making this happen? Usually there's a command-line too you run that takes the input XML and an XSLT and outputs the result.

You could schedule a Windows task to do it automatically. Or if you wanted to be really perverse, write an Awasu plugin channel that did it. Awasu would run the plugin automatically to "update" the channel but it would actually do the work you want.

ois wrote:Is it possible to make awasu not archive a particular channel?

Until recently it was but I had to take it out because it was causing problems.

ois
Posts: 39
Joined: Sun Mar 19, 2006 1:52 pm

Postby ois » Mon Jun 04, 2007 8:05 pm

How are you actually making this happen? Usually there's a command-line too you run that takes the input XML and an XSLT and outputs the result.

the xml file refers to this xsl file:

Code: Select all

[?xml version="1.0" encoding="ISO-8859-1"?]
[xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"]

[xsl:template match="/"]
 [html][head][/head]
[body]   
        [xsl:for-each select="rss/channel/item"]
       [xsl:sort select="title" /]
                 
                <item> [br /]
                       <title>[xsl:value-of select="title"/]</title> [br /]
                       <link>[xsl:value-of select="link"/]</link]  [br /]
                       <description>[xsl:value-of select="description"/]</description>  [br /]
                       <pubDate>[xsl:value-of select="pubDate"/]</pubDate> [br /]
                </item>
                [br /]
                [br /]


   
   [/xsl:for-each]
        [/body]
        [/html]
[/xsl:template]

[/xsl:stylesheet]


when you open the xml file in a browser it looks like sorted xml.

I don't know how to do command line stuff.
It all sounds like a bit of a palaver.

What about the possibility of setting the archive time to less than one day?

cheers!

User avatar
support
Site Admin
Posts: 3021
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Tue Jun 05, 2007 4:37 am

ois wrote:I don't know how to do command line stuff.

It'd be quite easy to do from the command line but you'd need to install an XSL processor to do it (not a big deal).

Otherwise, the easiest option would just to copy and paste the output and save it in another file. Probably just as easy since both these options have to be done manually (although if you do it from the command line, you can get Windows to do it automatically for you).

Alternatively, you could get a plugin channel to do the work for you as I described above (although you would still need to install another program (e.g. Python) to be able to run the plugin.

ois wrote:What about the possibility of setting the archive time to less than one day?

It wouldn't make any difference. Awasu always keeps at least the last feed received, regardless of how old it is. This is to avoid the scenario where all a channel's content has been deleted for being too old, so when you open the channel, there's nothing there.

ois
Posts: 39
Joined: Sun Mar 19, 2006 1:52 pm

Postby ois » Tue Jun 05, 2007 10:22 am

thanks - i'll look into all the solutions you suggest


Return to “Awasu - General Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests