Subject: [xsl] Question: Change string to nodeset for dynamic xml lookup From: "Ouen Worth" <oworth@xxxxxxxxxxx> Date: Thu, 15 Jan 2004 20:10:01 +0200 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Sort column in table, Norma Yeazell | Thread | RE: [xsl] Question: Change string t, Josh Canfield |
RE: [xsl] FW: Using a processing in, Beyer,Nathan | Date | RE: [xsl] Question: Change string t, Josh Canfield |
Month |