allywilson
Technical User
Hi,
I've just started using XML and XSL, and at the moment I've still got the whole HTML/JavaScript methodology stuck in my head.
What I'm trying to do is embed a number of quicktime movies onto one page. Now, the embed tag requires multiple attributes. I can do it but only if I specify all of the attributes on each tag...what I'd like to be able to do is just put a function that calls all of the same attributes used for the previous embed tags (like a javascript function would be able to do).
Here's what the XML doc looks like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="02.xsl"?>
<movies>
<properties>
<sourcemovie1>test2.3gp</sourcemovie1>
<width1>176</width1>
<height1>160</height1>
<controller1>TRUE</controller1>
<autoplay1>FALSE</autoplay1>
<loop1>FALSE</loop1>
<cache1>FALSE</cache1>
<type1>video/quicktime</type1>
</properties>
</movies>
Pretty basic right?
So...now this parts a bit longer, but this is what I am having to do for the XSL doc (keep in mind this example only shows me setting the attributes for just ONE embed tag - and I wanna do loads.):
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="movies/properties">
<embed>
<xsl:attribute name="src">
<xsl:value-of select="sourcemovie1"/>
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="width1"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="height1"/>
</xsl:attribute>
<xsl:attribute name="controller">
<xsl:value-of select="controller1"/>
</xsl:attribute>
<xsl:attribute name="autoplay">
<xsl:value-of select="autoplay1"/>
</xsl:attribute>
<xsl:attribute name="loop">
<xsl:value-of select="loop1"/>
</xsl:attribute>
<xsl:attribute name="cache">
<xsl:value-of select="cache1"/>
</xsl:attribute>
<xsl:attribute name="type">
<xsl:value-of select="type1"/>
</xsl:attribute>
</embed>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I've been trying to figure out how to do it with attribute-sets - but so far I've been unlucky in all attempts with it.
Anyone think they can walk me through using attribute-sets, or maybe showing me how the hell you write functions in XSL that are similar to javascript?
Cheers,
Ally
I've just started using XML and XSL, and at the moment I've still got the whole HTML/JavaScript methodology stuck in my head.
What I'm trying to do is embed a number of quicktime movies onto one page. Now, the embed tag requires multiple attributes. I can do it but only if I specify all of the attributes on each tag...what I'd like to be able to do is just put a function that calls all of the same attributes used for the previous embed tags (like a javascript function would be able to do).
Here's what the XML doc looks like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="02.xsl"?>
<movies>
<properties>
<sourcemovie1>test2.3gp</sourcemovie1>
<width1>176</width1>
<height1>160</height1>
<controller1>TRUE</controller1>
<autoplay1>FALSE</autoplay1>
<loop1>FALSE</loop1>
<cache1>FALSE</cache1>
<type1>video/quicktime</type1>
</properties>
</movies>
Pretty basic right?
So...now this parts a bit longer, but this is what I am having to do for the XSL doc (keep in mind this example only shows me setting the attributes for just ONE embed tag - and I wanna do loads.):
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="movies/properties">
<embed>
<xsl:attribute name="src">
<xsl:value-of select="sourcemovie1"/>
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="width1"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="height1"/>
</xsl:attribute>
<xsl:attribute name="controller">
<xsl:value-of select="controller1"/>
</xsl:attribute>
<xsl:attribute name="autoplay">
<xsl:value-of select="autoplay1"/>
</xsl:attribute>
<xsl:attribute name="loop">
<xsl:value-of select="loop1"/>
</xsl:attribute>
<xsl:attribute name="cache">
<xsl:value-of select="cache1"/>
</xsl:attribute>
<xsl:attribute name="type">
<xsl:value-of select="type1"/>
</xsl:attribute>
</embed>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I've been trying to figure out how to do it with attribute-sets - but so far I've been unlucky in all attempts with it.
Anyone think they can walk me through using attribute-sets, or maybe showing me how the hell you write functions in XSL that are similar to javascript?
Cheers,
Ally