[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Newbie --- XSLT Transformations

  • To: xml-dev@l...
  • Subject: Newbie --- XSLT Transformations
  • From: Ira Bargon III <xmldeveloper@o...>
  • Date: Wed, 18 Sep 2002 10:10:27 -0500 (CDT)
  • User-agent: IMP/PHP IMAP webmail program 2.2.7

xslt img tag

I am new to XML and this list, so please excuse this email if i have sent it to 
the wrong list. I am attempting to teach myself xml. I have created a xml 
document, xsl stylesheet and dtd just to get my feet wet with this new 
technology. I am having a problem writing my xslt style sheet. This sytle sheet 
transforms my xml data which is just a simple news article. Contents such as

<!ELEMENT articles (article+)>
<!ELEMENT article (title, section, date, author, bi_line, img_small?, 
img_large?, text)>

I thought that would be the best way to describe the xml data that im am using. 
The problem with my stylesheet has to do with transforming img_small and 
img_large which are not required elements. Here is the data it contains

<!ELEMENT img_large (#PCDATA)>

<!ATTLIST img_large
	src CDATA "/articleImages/"

So what im trying to do with this element is store the location of an image for 
my article. This is to be transformed by xslt for html. So im trying to end up 
with an html <img> tag. The src attribute is the relative directory of my root 
web directory.

Everything seems to work fine when there I have a <img_large> tag in my xml 
data. But when an article doesnt have an <img_large> then my stylesheet still 
attempts to create the html <img> tag. So, is there a way i can say "If 
image_large tag exist then apply the transformation if not then dont"

Here is what i have so far for creating an img tag under my xslt stylesheet. 
This is done while looping through each article element


   <xsl:attribute name="src"><xsl:value-of select="//@src" /><xsl:value-of      
select="img_large" /></xsl:attribute>
   <xsl:attribute name="width"><xsl:value-of 
select="//@width" /></xsl:attribute>
   <xsl:attribute name="height"><xsl:value-of 
select="//@height" /></xsl:attribute>
   <xsl:attribute name="align">right</xsl:attribute>


Any help would be greatley appreciated. Again if i have posted to a non newbie 
list then please excuse this email and if you could direct me to the proper 
list that would be great.


Ira M. Bargon III                                           
Online Gamming Leagues - http://www.onlinegammingleagues.com
Web Applications Developer                                  

eBoundHost, your web solutions partner!


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.