 |
| View previous topic :: View next topic |
| Author |
Message |
csinatra
Joined: 14 Jun 2005 Posts: 86
|
Posted: Tue Jan 31, 2006 5:40 pm Post subject: Template help please.... |
|
|
Wes,
I'm trying to get the variable in the date feild (after Tag Cust Name:) to display the Customers last name. Other than that - I'm cool.
Let me know how to do it if you would. Here is the template:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sw="http://www.interapptive.com/shipworks" extension-element-prefixes="sw">
<!-- Import core functions from Common -->
<xsl:import href="System\Common" />
<xsl:output method="html" encoding="utf-8" indent="yes" />
<sw:settings>
<sw:general>
<sw:context>order</sw:context>
<sw:type>standard</sw:type>
</sw:general>
</sw:settings>
<!-- Default template properties -->
<xsl:variable name="templateType" select="'invoice'" />
<xsl:variable name="showThumbnails" select="false()" />
<!-- -->
<!-- Start of processing -->
<!-- -->
<xsl:template match="/">
<html>
<head>
<title>
<xsl:if test="$templateType = 'invoice'">Invoice</xsl:if>
<xsl:if test="$templateType != 'invoice'">Packing Slip</xsl:if>
</title>
<!-- Output all the CSS required for this template -->
<xsl:call-template name="outputBaseTemplateCss" />
</head>
<body>
<!-- Output the body content for the template. -->
<xsl:call-template name="outputBaseTemplateContent" />
</body>
</html>
</xsl:template>
<!--
The following can be overriden by importing templates to provide
headers for each of the main sections.
-->
<xsl:template name="outputPageHeader">
</xsl:template>
<xsl:template name="outputHeaderPreAddress">
</xsl:template>
<xsl:template name="outputShipBillHeader">
</xsl:template>
<xsl:template name="outputOrderDetailsHeader">
</xsl:template>
<xsl:template name="outputOrderDetailsFooter">
</xsl:template>
<xsl:template name="outputOrderTotalsHeader">
</xsl:template>
<xsl:template name="outputPageFooter">
</xsl:template>
<!-- This template can be overriden in importing templates to insert
CSS that overrides the CSS in this template -->
<xsl:template name="outputOverrideCss">
</xsl:template>
<!-- Output all CSS required by this template -->
<xsl:template name="outputBaseTemplateCss">
<!-- Apply all the common CSS styles used by HTML output of the common functions. -->
<xsl:call-template name="outputStandardCss" />
<style>
#headerInfo
{
margin: 8px 0 8px 0;
}
/* Make the store address td as wide as possible, forcing orderinfo to the far left */
#storeaddress
{
width: 100%;
}
#storeaddress .companyName
{
font-weight: bold;
font-size: 13pt;
}
#orderinfo
{
padding: 0px;
}
#orderinfo td
{
font-weight:bold;
white-space: nowrap;
}
#orderinfo .label
{
padding-right:5px;
}
#orderinfo div
{
padding: 2px 8px;
border: 1px solid dimgray;
}
/* Make all images reach accross the page. */
#headerInfo,
#imgInvoice,
#imgBillShip,
#imgOrderInfo,
#imgOrderTotals
{
width: <xsl:value-of select="//ContentWidth" />in;
}
</style>
<!-- This is called to let importing templates override the CSS above. IT
does not have to be overridden. -->
<xsl:call-template name="outputOverrideCss" />
</xsl:template>
<!--
The main body content of the template.
-->
<xsl:template name="outputBaseTemplateContent">
<!-- If there is not just a single order its an error -->
<xsl:if test="count(//Order) != 1">
<p>
This template is designed to be per-order. There are currently
<xsl:value-of select="count(//Order)" /> orders in the XML input source.
</p>
<p>
Please adjust the template settings to be processed per-order.
</p>
</xsl:if>
<!-- Continue if there is only a single order as input -->
<xsl:if test="count(//Order) = 1">
<xsl:variable name="order" select="//Order[1]" />
<xsl:call-template name="outputPageHeader" />
<table id="headerInfo">
<tr>
<xsl:call-template name="outputHeaderPreAddress" />
<td id="storeAddress">
<xsl:call-template name="formatAddress">
<xsl:with-param name="address" select="//Store/Address" />
</xsl:call-template>
<xsl:if test="//Store/Address/Website != ''">
<xsl:value-of select="//Store/Address/Website" /><br />
</xsl:if>
</td>
<td id="orderinfo">
<div> <!-- This div is used only to provide a border -->
<table cellspacing="0">
<tr><td class="label">PO Number:</td><td class="value"><xsl:value-of select="$order/Number" /></td></tr>
<tr><td class="label">Placed:</td><td class="value"><xsl:value-of select="sw:ToShortDate($order/Date)" /></td></tr>
<tr><td class="label">Tag Cust Name:</td><td class="value"><xsl:value-of select="sw:ToShortDate($order/Date)" /></td></tr>
</table>
</div>
</td>
</tr>
</table>
<xsl:call-template name="outputShipBillHeader" />
<xsl:call-template name="formatAddress">
<xsl:with-param name="order" select="$order" />
</xsl:call-template>
<xsl:call-template name="outputOrderDetailsHeader" />
<xsl:call-template name="outputOrderDetails">
<xsl:with-param name="order" select="$order" />
<xsl:with-param name="showThumbnails" select="$showThumbnails" />
<xsl:with-param name="showAmounts" select="$templateType = 'invoice'" />
</xsl:call-template>
<xsl:call-template name="outputOrderDetailsFooter" />
<xsl:if test="$templateType = 'invoice'">
<xsl:call-template name="outputOrderTotalsHeader" />
<xsl:call-template name="outputOrderTotals">
<xsl:with-param name="order" select="$order" />
</xsl:call-template>
</xsl:if>
<div style="width: {//ContentWidth} in;">
<xsl:call-template name="outputPageFooter" />
</div>
<!-- This is the end of the test ensuring a single order -->
</xsl:if>
</xsl:template>
</xsl:stylesheet> |
|
| Back to top |
|
Wes Site Admin
Joined: 07 Oct 2002 Posts: 7427
|
Posted: Thu Feb 02, 2006 3:28 pm Post subject: |
|
|
Chris,
Here is your code, slightly modified, to accomplish your goal.
| Code: | <?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sw="http://www.interapptive.com/shipworks" extension-element-prefixes="sw">
<!-- Import core functions from Common -->
<xsl:import href="System\Common" />
<xsl:output method="html" encoding="utf-8" indent="yes" />
<sw:settings>
<sw:general>
<sw:context>order</sw:context>
<sw:type>standard</sw:type>
</sw:general>
</sw:settings>
<!-- Default template properties -->
<xsl:variable name="templateType" select="'invoice'" />
<xsl:variable name="showThumbnails" select="false()" />
<!-- -->
<!-- Start of processing -->
<!-- -->
<xsl:template match="/">
<html>
<head>
<title>
<xsl:if test="$templateType = 'invoice'">Invoice</xsl:if>
<xsl:if test="$templateType != 'invoice'">Packing Slip</xsl:if>
</title>
<!-- Output all the CSS required for this template -->
<xsl:call-template name="outputBaseTemplateCss" />
</head>
<body>
<!-- Output the body content for the template. -->
<xsl:call-template name="outputBaseTemplateContent" />
</body>
</html>
</xsl:template>
<!--
The following can be overriden by importing templates to provide
headers for each of the main sections.
-->
<xsl:template name="outputPageHeader">
</xsl:template>
<xsl:template name="outputHeaderPreAddress">
</xsl:template>
<xsl:template name="outputOrderDetailsHeader">
</xsl:template>
<xsl:template name="outputOrderDetailsFooter">
</xsl:template>
<xsl:template name="outputOrderTotalsHeader">
</xsl:template>
<xsl:template name="outputPageFooter">
</xsl:template>
<!-- This template can be overriden in importing templates to insert
CSS that overrides the CSS in this template -->
<xsl:template name="outputOverrideCss">
</xsl:template>
<!-- Output all CSS required by this template -->
<xsl:template name="outputBaseTemplateCss">
<!-- Apply all the common CSS styles used by HTML output of the common functions. -->
<xsl:call-template name="outputStandardCss" />
<style>
#headerInfo
{
margin: 8px 0 8px 0;
}
/* Make the store address td as wide as possible, forcing orderinfo to the far left */
#storeaddress
{
width: 100%;
}
#storeaddress .companyName
{
font-weight: bold;
font-size: 13pt;
}
#orderinfo
{
padding: 0px;
}
#orderinfo td
{
font-weight:bold;
white-space: nowrap;
}
#orderinfo .label
{
padding-right:5px;
}
#orderinfo div
{
padding: 2px 8px;
border: 1px solid dimgray;
}
/* Make all images reach accross the page. */
#headerInfo,
#imgInvoice,
#imgBillShip,
#imgOrderInfo,
#imgOrderTotals
{
width: <xsl:value-of select="//ContentWidth" />in;
}
</style>
<!-- This is called to let importing templates override the CSS above. IT
does not have to be overridden. -->
<xsl:call-template name="outputOverrideCss" />
</xsl:template>
<!--
The main body content of the template.
-->
<xsl:template name="outputBaseTemplateContent">
<!-- If there is not just a single order its an error -->
<xsl:if test="count(//Order) != 1">
<p>
This template is designed to be per-order. There are currently
<xsl:value-of select="count(//Order)" /> orders in the XML input source.
</p>
<p>
Please adjust the template settings to be processed per-order.
</p>
</xsl:if>
<!-- Continue if there is only a single order as input -->
<xsl:if test="count(//Order) = 1">
<xsl:variable name="order" select="//Order[1]" />
<xsl:call-template name="outputPageHeader" />
<table id="headerInfo">
<tr>
<td id="storeAddress">
<xsl:call-template name="formatAddress">
<xsl:with-param name="address" select="//Store/Address" />
</xsl:call-template>
<xsl:if test="//Store/Address/Website != ''">
<xsl:value-of select="//Store/Address/Website" /><br />
</xsl:if>
</td>
<td id="orderinfo">
<div> <!-- This div is used only to provide a border -->
<table cellspacing="0">
<tr><td class="label">PO Number:</td><td class="value"><xsl:value-of select="$order/Number" /></td></tr>
<tr><td class="label">Placed:</td><td class="value"><xsl:value-of select="sw:ToShortDate($order/Date)" /></td></tr>
<tr><td class="label">Tag Cust Name:</td><td class="value"><xsl:value-of select="$order/Address[@type='bill']/FirstName" /><xsl:text> </xsl:text><xsl:value-of select="$order/Address[@type='bill']/LastName" /></td></tr>
</table>
</div>
</td>
</tr>
</table>
<xsl:call-template name="outputOrderDetailsHeader" />
<xsl:call-template name="outputOrderDetails">
<xsl:with-param name="order" select="$order" />
<xsl:with-param name="showThumbnails" select="$showThumbnails" />
<xsl:with-param name="showAmounts" select="$templateType = 'invoice'" />
</xsl:call-template>
<xsl:call-template name="outputOrderDetailsFooter" />
<xsl:if test="$templateType = 'invoice'">
<xsl:call-template name="outputOrderTotalsHeader" />
<xsl:call-template name="outputOrderTotals">
<xsl:with-param name="order" select="$order" />
</xsl:call-template>
</xsl:if>
<div style="width: {//ContentWidth} in;">
<xsl:call-template name="outputPageFooter" />
</div>
<!-- This is the end of the test ensuring a single order -->
</xsl:if>
</xsl:template>
</xsl:stylesheet> |
Let us know if you need further assistance.
Thanks,
Wes
Interapptive, Inc. |
|
| Back to top |
|
|
|
 |
 |
Powered by phpBB © 2001, 2002 phpBB Group
|
 |
|