Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 1st, 2007, 07:44 AM
Authorized User
 
Join Date: Mar 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding elements from an XML to XSL.

I need to add an XML to my stylesheet.

Here is the problem

I have an XSL as follows:

Code:
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" 
xmlns:fix="http://www.fixprotocol.org/FIXML-4-4" 
xmlns:i="http://www.abc.com/interests:i" 
exclude-result-prefixes="">
<xsl:output method="xml"/>

<xsl:param name="Description">EQ.D</xsl:param>
    <xsl:template match="fix:FIXML">
        <xsl:apply-templates select="fix:Order"/>
</xsl:template>

<xsl:template match="fix:Order">

    <xsl:element name="i:Interest">

    <xsl:element name="strategies.Settlement">
    <xsl:value-of select="@SettlDt"></xsl:value-of>                  

    <xsl:element name="Delta"></xsl:element>
    <xsl:element name="Ref"></xsl:element>

</xsl:element>

2) I have an XML document which is:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<i:Underlying value="KGF" xmlns:common="http://www.ABC.com/common" xmlns:i="common">
    <common:Code>KGF</common:Code>
    <common:Reuters>KGF.L</common:Reuters>
</i:Underlying>
3) The entire XML should look like this:
Code:
<Interest>
  <strategies.Settlement>0</strategies.Settlement>
  <Delta/>
  <Ref/>
  <i:Underlying value="KGF">
  <common:Code>KGF</common:Code>
  <common:Reuters>KGF.L</common:Reuters>
  </i:Underlying>
</Interest>
How can I include the XML contents in my XSL? Can anybody please suggest?
Is this possible?



 
Old May 1st, 2007, 12:12 PM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rushman
Default

Try the document() function...

Dijkstra's law on Programming and Inertia:

If you don't know what your program is supposed to do, don't try to write it.





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL file can't find elements in XML data? Mateo1041 XSLT 2 September 18th, 2008 09:37 AM
how t do comparision of elements in xsl suji XSLT 2 February 28th, 2008 12:27 PM
Dynamically Finding Elements in XSL tclancy XSLT 2 March 1st, 2006 03:25 PM
adding elements in XSLT 1.0 spencer.clark XSLT 3 July 25th, 2005 09:41 AM
adding option elements dynamically to a select richard.york Javascript 4 December 5th, 2003 04:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.