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

Include problem...

Subject: Include problem...
From: "King Wilder" <king@xxxxxxxxxxxxxx>
Date: Thu, 22 Aug 2002 11:30:57 -0700
include form
I have an include question.

I'm building a Web application that has many forms.  More than one of the
forms requires pulldown menus with similar data such as a State menu on a
customer form.  I want to be able to use centrally located State menu XML
and XSL documents that are transformed and included in any other XSL
document.

My question is: is it possible to include and transform a state menu XML
document with a state menu XSL file and include the result into the customer
XSL and then any other XSL document?

An example of all the documents are below.

Any help is appreciated.

Thanks,

King Wilder
king@xxxxxxxxxxxxxx


This example is transformed via ASP.

===========================================
Customer information
===========================================

This is the Customer XML snippet.
Filename: customer.xml

<Customer>
	<FirstName>John</FirstName>
	<LastName>Smith</LastName>
	...
	<Address>123 Fourth St.</Address>
	<City>Los Angeles</City>
	<State>CA</State>
</Customer>

This is the Customer XSL.
Filename: customer.xsl

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<form name="myForm">
			First name:
			<xsl:element name="input">
				<xsl:attribute name="name">firstname</xsl:attribute>
				<xsl:attribute name="value">
					<xsl:value-of select="//FirstName"/>
				</xsl:attribute>
			</xsl:element>
			<br/>
			Last name:
			<xsl:element name="input">
				<xsl:attribute name="name">lastname</xsl:attribute>
				<xsl:attribute name="value">
					<xsl:value-of select="//Lastname"/>
				</xsl:attribute>
			</xsl:element>
			<br/>
			...
			State:

			<!-- ++++++++++++++++++++++++ -->
			<!-- How do I include the transformed state XML document here? -->
			<!-- Please show an example.  I know about document() and include,
but -->
			<!-- I don't know how they are implemented here.  Thanks. -->
			<!-- ++++++++++++++++++++++++ -->



		</form>
	</xsl:template>
</xsl:stylesheet>

===========================================
End Customer information
===========================================

===========================================
Begin State menu info
===========================================

This is the State menu XSL.
Filename: statemenu.xsl

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
	<xsl:call-template name="statecombo"></xsl:call-template>
</xsl:template>

	<xsl:template name="statecombo">
		<xsl:param name="selected-option-value">@value</xsl:param>
		<xsl:param name="control-name">state</xsl:param>
		<select size="1">
			<xsl:attribute name="name"><xsl:value-of
select="$control-name"/></xsl:attribute>
			<xsl:for-each select="/statemenu/option">
				<option>
					<xsl:attribute name="value"><xsl:value-of
select="@value"/></xsl:attribute>
					<xsl:if test="@value = $selected-option-value">
						<xsl:attribute name="selected">yes</xsl:attribute>
					</xsl:if>
					<xsl:value-of select="@description"/>
				</option>
			</xsl:for-each>
		</select>
	</xsl:template>

</xsl:stylesheet>



This is the State menu XML snippet.
Filename: statemenu.xml

<statemenu name="state" id="state">
<option value="AL" description="Alabama" />
<option value="AK" description="Alaska" />
<option value="AB" description="Alberta" />
<option value="AZ" description="Arizona" />
...
<option value="YT" description="Yukon" />
</statemenu>

===========================================
End State menu info
===========================================

King Wilder
-------------
Gizmo Beach
king@xxxxxxxxxxxxxx
www.gizmobeach.com
626 351-4334
-------------


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
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.