Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

xml

Options
  • 06-01-2004 12:52pm
    #1
    Registered Users Posts: 6,240 ✭✭✭


    Ok this is what I want

    a very simple xml/html form

    the xml has these elements
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!-- Edited with XML Spy v4.2 -->
    <catalog>
    	<page>
    		<brief>Brief Description</briefD>
    		<pic>images/dsc00173.jpg</pic>
    		<detail>Details</detail>
    	</page>
    </catalog>
    

    the xml will have 3 parts - a brief description, a picture, and a detailed description

    The html I have will have two buttons a next+previous etc
    and they will navagate through the xml .. this all works fine
    but I want to actually desplay the picture, but I don't know how .. so far I can reference where the pic is .. just dunno how to output it

    any ideas ??

    the html is defined as
    <body>
    <xml src="merc_pictures.xml" id="xmldso" async="false"></xml>
    
    <p>
    Brief Description : 
    <span datasrc="#xmldso" datafld="briefd"></span>
    <br />Picture :
    <span datasrc="#xmldso" datafld="pic"></span>
    <br />Full :
    <span datasrc="#xmldso" datafld="detailD"></span>
    </p>
    
    *I took out excess html
    


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Not really sure what you are up to but wouldn't it be something like...
    <IMG SRC='<span datasrc="#xmldso" datafld="pic"></span>'
    >
    


  • Closed Accounts Posts: 857 ✭✭✭davros


    Originally posted by hussey
    the html is defined as
    <body>
    <xml src="merc_pictures.xml" id="xmldso" async="false"></xml>
    
    <p>
    Brief Description : 
    <span datasrc="#xmldso" datafld="briefd"></span>
    <br />Picture :
    <span datasrc="#xmldso" datafld="pic"></span>
    <br />Full :
    <span datasrc="#xmldso" datafld="detailD"></span>
    </p>
    
    
    This isn't html though. There is no <xml> tag in html, and the span tag does not have datasrc and datafld attributes.

    Apart from that, I'm not sure either what you are aiming at. To output a picture, you need to produce html like this:
    <img src="images/dsc00173.jpg" alt="Brief Description"/>
    


  • Closed Accounts Posts: 989 ✭✭✭MrNuked


    I think you'll need a scripting language to do this, like Javascript. you could definitely do it using Java Servlets.


  • Registered Users Posts: 6,240 ✭✭✭hussey


    Yes I know
    I just wanted to do it with xml - for testing

    xslt works ok


  • Closed Accounts Posts: 989 ✭✭✭MrNuked


    I meant use the scripting language or servlet in conjunction with the xml.

    Java even has an xml parser. (called SAX afair)

    Do you mean you want to do it using markup languages only?


  • Advertisement
  • Closed Accounts Posts: 857 ✭✭✭davros


    OK, with XSLT then:
    <xsl:template match="catalog/page">
      <img src="{pic}" alt="{brief}"/>
    </xsl:template>
    
    should result in this output:
    <img src="images/dsc00173.jpg" alt="Brief Description"/>
    
    I haven't tested it. That what you want?


Advertisement