OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] SWF using XML

[ Lists Home | Date Index | Thread Index ]

The examples are attatched
If they are not quite what you want email me.
Good luck
James
----- Original Message ----- 
From: "Sandeep Paradkar" <sandeep.paradkar@learningmate.com>
To: "'xml-dev'" <xml-dev@lists.xml.org>
Sent: Tuesday, 21 January 2003 05:08
Subject: [xml-dev] SWF using XML


> Hi,
> 
> I am using an xml file to store data and html as my presentation layer. I
> need to call different swf files through the xml file. The swf files are
> stored in the same folder. How do I do the same?
> 
> 
> Regards,
> Sandeep
> 
> 
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>

swf_file.swf

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>


<xsl:template match="/">
<html>
<body><font face="courier new">
<p>
   <xsl:apply-templates select="//body" />
</p>
</font>
</body>
</html>

</xsl:template>

<!--Heading-->
<xsl:template match="name">
<h2><xsl:value-of select="@value" /></h2>
</xsl:template>

<!--Comments-->
<xsl:template match="commenta">
<font face="courier new" color="green"><i>
<h4><xsl:value-of select="." /></h4>
</i></font>
</xsl:template>

<!--Link-->
<xsl:template match="link">
<font face="courier new" color="blue"><u>
<h5><a href="{@location}"><xsl:value-of select="." /></a></h5>
</u></font>
</xsl:template>

<!--The XSL for the SWF (explanation below)-->

<xsl:template match="swf">	

<br />	
<object type="application/x-shockwave-flash" data="{@src}" 
	width="{@width}" height="{@height}">
	<param name="movie" value="{@src}" />
</object>	

</xsl:template>

<!--
How it works

The above <xsl:template match="swf"> tells it what to do if it finds a <swf /> tag 

You can put any HTML tag between the <xsl:template match="swf"> 
tags. So long as it closes eg <img src="image.jpg > becomes <img src="image.jpg />
note the /> at the end. The same applies with any other tags that dont usually
have a closing tag eg. <br />. So all tags must close.

The {@src}looks in the tag <swf /> for an attribute <swf src="" />
The same applies with height {@height} and width {@width}

so i could put a tag called say: 
<bob>Hello </bob>
in the XML

and in the XSL have
<xsl:template match="bob">	
<br />	
<strong>
<xsl:value-of select="." />
</strong>
</xsl:template>

and when viewed in a browser
it will write whatever is between the <bob></bob>
tags in BOLD 

Mail me if you need more info rcxau@yahoo.com.au
-->	
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<!--Telling the parser to use the XSLT stylesheet-->
<?xml-stylesheet href="swf.xsl" type="text/xsl"?>

<body>
<name value="SWF in XML" />
<commenta>
Feel free to e-mail me if you need any more help
If this isn't what you want or you want to know how to do something with it
</commenta>
<link location="mailto:rcxau@yahoo.com.au";>rcxau@yahoo.com.au</link>


<!-- Inserting .SWF -->
<!--The below tag might seem short but most of the code is hidden in the XSLT-->
<swf src="swf_file.swf" height="200" width="400" />

</body>

  • References:
    • SWF using XML
      • From: "Sandeep Paradkar" <sandeep.paradkar@learningmate.com>



 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS