+ Post New Thread
Results 1 to 6 of 6
How do you do....it? Thread, XML - Formatting confusion in Technical; Hello, I have a program that i can automate to produce an xml report each morning. Staff would like the ...
  1. #1

    Join Date
    Mar 2007
    Posts
    124
    Thank Post
    28
    Thanked 5 Times in 4 Posts
    Rep Power
    16

    XML - Formatting confusion

    Hello,

    I have a program that i can automate to produce an xml report each morning.

    Staff would like the information contained in the page viewable as a webpage.

    To make any sense of the XML i have followed a guide and created an XSL page. I undertsand that if the XML page contains a reference to the XSL page then the page can be rendered correctly.

    The formatting will never change so the XSL can stay static.

    I have done all this and it works great i have a page displaying the XML nicely on a webpage. But how do i get each new, daily generated XML page to know that it has to reference the XSL page? I would like this to be autmated if possible. Is there a way of injecting the reference?

    Am i going about this the wrong way round?

    TIA

  2. #2

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,855
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    181
    No, you're going about it the right way. What you haven't said is how the XML gets generated...

  3. #3

    Join Date
    Mar 2007
    Posts
    124
    Thank Post
    28
    Thanked 5 Times in 4 Posts
    Rep Power
    16
    The program is a behaviour recording system. It can generate a file, such as the shortened one i have attached. I can create an xsl file that can produce a table and separate the headings into columns, but i am not sure how to make all newly produced files,- link to the xsl file.
    Attached Files Attached Files
    Last edited by steele_uk; 26th January 2009 at 11:46 AM.

  4. #4

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,855
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    181
    I'd obfuscate that file a bit more thoroughly.

    You either need to have your stylesheet link embedded by whatever generates the XML, or do it yourself later on, either by hand or automated.

  5. #5

    Join Date
    Mar 2007
    Posts
    124
    Thank Post
    28
    Thanked 5 Times in 4 Posts
    Rep Power
    16
    All the names have been chnaged to protect the guilty!

    I am trying to find how to automate the referencing/ embedding of the xsl file.

    Any ideas?

  6. #6

    Join Date
    Oct 2008
    Location
    Gosport
    Posts
    64
    Thank Post
    1
    Thanked 18 Times in 13 Posts
    Rep Power
    15
    Assuming you're on a linux system, try a cron job running something like
    Code:
    sed -e 's/^<(.*?)>/<\1><?xml-stylesheet type="text/xsl" href="mystyle.xsl"?>/' inputFileName > outputFileName
    ... or something on the generated file.
    That should use sed to parse the file named inputFileName, find a match to the regex, and replace it with something else, then store that processed file in outputFileName.

    The quoted bit breaks down as:
    s - Search and replace
    /^<(.*?)> - find me the start of the file (^), then a <, then stuff until a >
    /<\1><?xml.....?> - replace it with < then the stuff you found before, then >, then <?xml...?> (your stylesheet reference).

    I've not tested this and verified the exact syntax, but I'd expect something in that direction to do the job.

    ... of course if you're on a Windoze server you'll not have the same tools, so I can't help you there. Good luck.

    Hello
    :-Dave

SHARE:
+ Post New Thread

Similar Threads

  1. Need help with formatting Acer TM 5720
    By Bluetooth in forum Windows Vista
    Replies: 15
    Last Post: 16th September 2008, 02:04 PM
  2. C# Help - Datagrid cell formatting
    By Gatt in forum Coding
    Replies: 6
    Last Post: 22nd July 2008, 08:33 PM
  3. Conditional formatting help needed
    By Jobos in forum How do you do....it?
    Replies: 3
    Last Post: 3rd June 2008, 01:58 PM
  4. Help with conditional formatting
    By randle in forum Windows
    Replies: 3
    Last Post: 25th October 2007, 01:20 PM
  5. formatting w98
    By chrbb in forum Windows
    Replies: 6
    Last Post: 21st February 2006, 11:36 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •