Karl Blessing
Programmer
I have a price dropdown list. As shown in the Partial XML here
I have this portion of the XSL that I wish to change.
the bolded areas is where I'd like to fill with the first element of the prints list, rather than having to pull from a seperate price tag as a default.
How can I basically go down into the child of a current area, and pull the first price/name out of two tags down in a way.
Karl Blessing
PHP/MySQL Developer
Code:
<galleries>
<gallery id="bees">
<image name="crw_0640" convertable="yes">
<longname>Bee on Yellow Flower</longname>
<description>A honey bee on top of a yellow flower. Grass out of focus in background.</description>
<price>125.00</price>
<prints>
<print name="Electronic File" price="125.00" />
<print name="3.5x5" price="5.00" />
<print name="4 x 6" price="7.00" />
<print name="5 x 7" price="10.00" />
<print name="8 x10" price="20.00" />
<print name="8 x12" price="25.00" />
<print name="11x14" price="35.00" />
<print name="16x20" price="45.00" />
</prints>
<dimension>3076x2052 pixels (10.2 x 6.8 inches @ 300 DPI)</dimension>
<format>8-bit LZW TIFF</format>
</image>
....
</gallery>
</galleries>
I have this portion of the XSL that I wish to change.
Code:
<xsl:template match="prints">
<select name="prints" onchange="setprice(this.options[this.options.selectedIndex].value);">
<xsl:apply-templates select="print" />
</select>
</xsl:template>
<xsl:template match="print">
<option><xsl:attribute name="value"><xsl:value-of select="../../longname"/>:<xsl:value-of select="./@name"/>-<xsl:value-of select="./@price"/></xsl:attribute>
<xsl:value-of select="./@name"/> - <xsl:value-of select="./@price"/> USD
</option>
</xsl:template>
<xsl:template match="image">
<xsl:if test="$image = ./@name">
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td>
<div style="border:1px solid #000000;padding:0px;background:#606B73;">
<table border="0" cellspacing="0" cellpadding="2" width="100%" style="background:#333A40;color:#FFFFFF;">
<tr>
<td class="bodysubhead">
Purchase Information
</td>
<td align="right" class="bodysubhead">
[<a id="purchase_link" onclick="toggle(this, 'purchase');" title="show/hide" href="javascript: void(0);" style="text-decoration:none;color:#FFFFFF;">Close</a>]
</td>
</tr>
</table>
<div id="purchase" style="padding:0px;">
<p class='para'>
<b>ID:</b><xsl:text> </xsl:text><xsl:value-of select="./@name"/><BR/>
<b>Name:</b><xsl:text> </xsl:text><xsl:value-of select="./longname"/><BR/>
<b>Description:</b><xsl:text> </xsl:text><xsl:value-of select="./description"/><BR/>
<b>Dimension:</b><xsl:text> </xsl:text><xsl:value-of select="./dimension"/><BR/>
<b>Format:</b><xsl:text> </xsl:text><xsl:value-of select="./format"/><BR/>
<xsl:apply-templates select="prints" />
</p>
<form target="paypal" name="paypal" id="paypal" action="[URL unfurl="true"]https://www.paypal.com/cgi-bin/webscr"[/URL] method="post">
<input type="image" src="[URL unfurl="true"]https://www.paypal.com/en_US/i/btn/x-click-but22.gif"[/URL] name="submit" title="Make payments with PayPal - it's fast, free and secure!" alt="Make payments with PayPal - it's fast, free and secure!"/>
<input type="hidden" name="add" value="1"/>
<input type="hidden" name="cmd" value="_cart"/>
<input type="hidden" name="business">
<xsl:attribute name="value"><xsl:value-of select="$account"/></xsl:attribute>
</input>
[b]<input type="hidden" name="item_name">
<xsl:attribute name="value"><xsl:value-of select="./longname"/><xsl:text>:Electronic File</xsl:text></xsl:attribute>[/b]
</input>
<input type="hidden" name="item_number">
<xsl:attribute name="value"><xsl:value-of select="./@name"/></xsl:attribute>
</input>
[b]<input type="hidden" name="amount" >
<xsl:attribute name="value"><xsl:value-of select="./price"/></xsl:attribute>
</input>[/b]
<input type="hidden" name="no_note" value="1"/>
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" name="lc" value="US"/>
</form>
<xsl:if test="./@convertable = 'yes'">
<i>This file may be converted to another format upon request in order form</i><BR/>
</xsl:if>
<a href="/-legal/">License Agreement for Purchased Photographs</a>
</div>
</div>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript">toggle(getObject('purchase_link'), 'purchase');</script>
</xsl:if>
</xsl:template>
the bolded areas is where I'd like to fill with the first element of the prints list, rather than having to pull from a seperate price tag as a default.
How can I basically go down into the child of a current area, and pull the first price/name out of two tags down in a way.
Karl Blessing
PHP/MySQL Developer