Results 1 to 8 of 8

Thread: XSL and XML

  1. #1
    Join Date
    Apr 2009
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default XSL and XML

    Hi I hope I can post this here. I am looking for some help with rendering XML (in html) using a XSL or XSLT stylesheet. I am however quite confused on the linking aspect. Does the text file named for example mystyle.xsl need to have the

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
    in it to run even if its local?

    Can someone direct me to some reading on styling for XML? Can the XML be rendered without using HTML tags? For example

    Code:
    <radio>
    		
    <song>
    	<title>Cuz it's Hot</title>
    	<composer>Thrill Kill Kult</composer>
    	<file>music/indust/cuzitshot.mp3</file>
    </song>
    </radio>
    Can this code be rendered and styled using XSL? IF so could someone give me an example? Thanks in advance for any help or direction to reading.

  2. #2
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there The Red,

    check out the attachment for a possible solution to your problem.

    coothead

  3. The Following User Says Thank You to coothead For This Useful Post:

    The Red (02-28-2010)

  4. #3
    Join Date
    Apr 2009
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I have moved beyond this a bit but have run into another problem. How can I get individual hyperlinks to show up in dynamically generated XHTML. I hope my enclosed files show my point. Is it possible to use the
    Code:
    <a href="">My Link</a>
    tags if I use a XHTML DTD? I've tried that but I dont know if it needs to be declared differently.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    Code:
    Starts with <! while XML declarations start <?
    Any help is appreciated (and may save my forhead from hitting the wall),

    Red
    Last edited by The Red; 02-28-2010 at 07:24 AM.

  5. #4
    Join Date
    Apr 2009
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Also Coothead I found your DTD to be informative. Thank you.

  6. #5
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there The Red,

    I hope that the attachment may "save your forehead from hitting the wall".

    coothead

  7. #6
    Join Date
    Apr 2009
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Coothead,

    THANK YOU!!! That is exactly what I was looking for. One more question:

    Can you specify unique names inside the tags?
    Code:
    <file></file>
    Example:
    Code:
    <file>www.google.com</file>
    But I want it to display like this
    Code:
    <file>Click Here</file> or <file>Google</file>
    I know this is kind of like splitting hairs, but I am curious. Would you have to give say the
    Code:
    <file>
    Element an attribute value?
    Code:
    <file id="1"></file>
    If so how would you go about calling that with your xsl sheet? Would it look like this?
    Code:
    a href="{file[1]}" style="
        font-size:10pt;
        font-style:bold;
        color:#000;
    ">
      <xsl:value-of select="file"/>
    </a>
    Thank you again for your help.

  8. #7
    Join Date
    Apr 2009
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Sorry post script.
    What does the + mean in your DTD?

    Code:
    <!ELEMENT radio (header,song+)>

  9. #8
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there The Red,

    What does the + mean in your DTD?
    Code:
    
    <!ELEMENT radio (header,song+)>
    
    You must understand that I am not, by any means, an XML/XLS expert.
    So my understanding is that, it means that the song element contains nested elements.

    I don't seem to be too bad though at problem solving, though.

    Check out the attachment for a solution to your latest problem.

Bookmarks

Posting Permissions

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