ASP Error: 70
Description: Permission denied
Source: Microsoft VBScript runtime error

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

Merging data (two xml documents, two context nodes)

Subject: Merging data (two xml documents, two context nodes)
From: "McKeever, Marty" <marty.mckeever@xxxxxxxxxxxxxxxxx>
Date: Tue, 18 Dec 2001 09:22:30 -0500
how two config.xml
I'm creating an application to build up a data.xml file, where the interface
is created via XSLT by combining the structure of a config.xml with the
values contained in the data.xml being created.  The interface is the
output.  For example:

data.xml
<page name="foo" type="A"></page>
	the name and type attributes are populated via the interface created
from config.xml

config.xml
<page>
	<attributes>
	<attribute attname="name" widget="text"/>
	<attribute attname="type" widget="select">
		<option value="PR">Press Release</option>
		<option value="A">Article</option>
	</attribute>
	</attributes>
</page>


So, while parsing the data.xml in interface.xsl I have the following
template:

<xsl:template match="page">
	Page Options:
	<xsl:call-template name="makeAttributes">
	<xsl:with-param name="prefix">page</xsl:with-param>
	</xsl:call-template>
</xsl:template>

Template "makeAttributes" then reads the config file to create the
interface:

<xsl:template name="makeAttributes">
<xsl:param name="prefix"/>
	<xsl:for-each
select="document('config.xml')/page/attributes/attribute">
		<xsl:if test="@widget='text'">
			<input type="text" name="{$prefix}|{@attname}"
value="{??? value "foo" from data.xml/page/@name ???}" />
		</xsl:if>
		<xsl:if test="@widget='select'">
			<select name="{$prefix}|{@attname}">
			<xsl:for-each select="option">
				<option value="{@value}">
				<xsl:if test="@value=??? value "A" from
data.xml/page/@type ???">
					<xsl:attribute
name="selected">selected</xsl:attribute>
				</xsl:if>
				<xsl:value-of select="."/></option>
			</xsl:for-each>
			</select>
		</xsl:if>		
	</xsl:for-each>
</xsl:template>

So the problem here is how to read data from the original context node
(data.xml/page) after the called template has changed its context to
congfig.xml/page/attributes/attribute?

I think (hope) i'm just missing something simple...
Suddenly i'm wondering if i should be parsing config.xml as the base
document, and modifying it according to the contents of data.xml, instead if
the other way around.

Thanks for any comments,
Marty
 

 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.