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

Question: Change string to nodeset for dynamic xml loo

Subject: Question: Change string to nodeset for dynamic xml lookup
From: "Ouen Worth" <oworth@xxxxxxxxxxx>
Date: Thu, 15 Jan 2004 20:10:01 +0200
change string to xml
I have tried to find a solution to this and it seems to be that I need to
use the xsl:key and key function, but I have had no luck

Here is what I am trying to do so far without the key. 

I am trying to create an output xml that is formed by a xsl that references
a xml that contains definition data for retrieving data from an external xml
file.

The reason for this is so that there is an easy to create xml definition
file that can be created from csv - which can be maintained by xml
illiterate personal - which is then used to validate external xml for
business rule purposes. The value of the external element needs to be
included in the output xml for this reason.

However, the Value element always contains the value of the Xpath element
and not the value of the element that the string in Xpath refers to in the
external xml.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:variable name="Order" select="document('Order.xml')/Order"/>
	<xsl:template match="/">
		<Validate>
			<xsl:for-each select="StandardCheck/Definition">
				<Field>
					<Requirement>
						<xsl:value-of
select="Requirement"/>
					</Requirement>
					<XPath>
						<xsl:value-of
select="XPath"/>
					</XPath>
					<Value>
						<xsl:apply-templates
select="$Order">
							<xsl:with-param
name="XPath" select="XPath"/>
						</xsl:apply-templates>
					</Value>
				</Field>
			</xsl:for-each>
		</Validate>
	</xsl:template>
	<xsl:template match="Order">
		<xsl:param name="XPath"></xsl:param>
		<xsl:value-of select="$XPath"/>
	</xsl:template>
</xsl:stylesheet>

<?xml version="1.0"?>
<StandardCheck DocType="Order">
	<Definition>
		<Requirement>M</Requirement>
		<XPath>/Order/OrderHeader/OrderIssueDate</XPath>
	</Definition>
	<Definition>
		<Requirement>R</Requirement>
	
<XPath>/Order/OrderHeader/OrderNumber/BuyerOrderNumber</XPath>
	</Definition>
</StandardCheck>

<?xml version="1.0"?>
<Order>
  <OrderHeader>
    <OrderNumber>
      <BuyerOrderNumber>4060001624</BuyerOrderNumber>
    </OrderNumber>
    <OrderIssueDate>20031205T08:52:13+02:00</OrderIssueDate>
    <OrderReferences>
      <AccountCode>
        <Reference>
          <RefNum>1000</RefNum>
        </Reference>
      </AccountCode>
    </OrderReferences>
  </OrderHeader>
<Order>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

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.