473,657 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Namspace Issue and Query

56 New Member
I am using my own namespace called xmlns:i="http://www.ABC/int:i"
in my XSL style sheet.

The input XML document (which has its own namespace) needs to be
mapped with the elements defined in my namespace.

1)The Input XML Document generated and given is as follows:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet type="text/xsl"?>
  3. <FIXML xmlns="http://www.fixprotocol.org/FIXML-4-4">
  4.     <Order Acct="1" ExDest="ExchDest">
  5.         <Hdr SeqNum="2" Snt="2007-04-05T13:34:47" />
  6.         <Instrmt Issr="Barclays" MMY="200903" />
  7.         <OrdQty Cash="1" Qty="500"/>
  8.     </Order>
  9. </FIXML>
  10.  
  11. -------------------------------------------------
  12. The resultant Output should be as:
  13. -------------------------------------------------
  14. <i:ID>1</i:ID>
  15. <i:Date Format="dd mmm yyyy hh:mm:ss">2007-04-05T13:34:47 </i:Date>
  16. <i:Underlying value="YEN>
  17.    <sample:ISSR>Barclays</sample:ISSR>
  18. </i:/Underlying>
  19.  
  20. -------------------------------------------------
  21. The XSL I am using is this
  22. ------------------------------------------------
  23. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  24.                               xmlns:i="http://www.ABC/int:i" >
  25.  
  26. <xsl:template match="FIXML">
  27. <xsl:apply-templates  select ="Order"/>
  28. </xsl:template>
  29. <xsl:template match="Order">
  30.  
  31. <OrderDet>
  32. <i:ID>
  33. <xsl:value-of select="@Acct"/> 
  34. </i:ID>
  35. </OrderDet>
  36.  
  37. <i:Date>
  38. <xsl:attribute name="Format">
  39.     <xsl:value-of select="Instrmt/@MMY" />
  40.   </xsl:attribute>
  41. </i:Date>
  42.  
  43. </OrderDet>
  44.  
  45. If I include the namespace xmlns:i="http://www.ABC/int:i" in my XSL,
  46. this gets displayed as an attribute of  element OrderDet.
  47.  
  48. <OrderDet xmlns:i="http://www.tfs.com/common/interests:i">
  49.  
  50. 1)I dont what this to be an attribute of OrderDet element.
  51.  
  52. 2) How can I map the input XML elements to my namespace i:
  53.    if I dont include my namspace i: in my XSL.?
  54.  
  55.   It gets a bit frustrating to include i: as a prefix to 
  56.    every element in my XSL
  57.  
  58.   Is there a mapping or a better way to do it.
  59.  
  60.   Help really appreciated.
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
Apr 17 '07 #1
1 1357
Dököll
2,364 Recognized Expert Top Contributor
[HTML]
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl"?>
<FIXML xmlns="http://www.fixprotocol .org/FIXML-4-4">
<Order Acct="1" ExDest="ExchDes t">
<Hdr SeqNum="2" Snt="2007-04-05T13:34:47" />
<Instrmt Issr="Barclays" MMY="200903" />
<OrdQty Cash="1" Qty="500"/>
</Order>
</FIXML>

-------------------------------------------------
The resultant Output should be as:
-------------------------------------------------
<i:ID>1</i:ID>
<i:Date Format="dd mmm yyyy hh:mm:ss">2007-04-05T13:34:47 </i:Date>
<i:Underlying value="YEN>
<sample:ISSR>Ba rclays</sample:ISSR>
</i:/Underlying>

-------------------------------------------------
The XSL I am using is this
------------------------------------------------
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:i="http://www.ABC/int:i" >

<xsl:template match="FIXML">
<xsl:apply-templates select ="Order"/>
</xsl:template>
<xsl:template match="Order">

<OrderDet>
<i:ID>
<xsl:value-of select="@Acct"/>
</i:ID>
</OrderDet>

<i:Date>
<xsl:attribut e name="Format">
<xsl:value-of select="Instrmt/@MMY" />
</xsl:attribute>
</i:Date>

</OrderDet>
[/HTML]
I am not sure what youa re trying to do. Can you tell us a little more?

I am leaving this link with you, hope it steers you in the right direction: http://www.w3schools.com/xsl/xsl_languages.asp

In a bit!
Jul 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5216
by: Paul Mateer | last post by:
Hi, I have been running some queries against a table in a my database and have noted an odd (at least it seems odd to me) performance issue. The table has approximately 5 million rows and includes the following columns: DocID (INTEGER, PRIMARY KEY, CLUSTERED) IsRecord (INTEGER, NONCLUSTERED)
9
10086
by: bc | last post by:
Hello all, Background: I've posted a couple questions recently regarding using BCP to extract many tables to text files. I've written an extract application that bcp's about 100 tables from a database to text files. I've run into a couple limitations using BCP, but I finally landed on (what I thought) was a solid solution. I now call bcp passing a sproc name and a parameter or two and having that sproc execute the query for me, thereby...
0
3302
by: Miranda Evans | last post by:
I noticed several postings about issues related to "run-time error 3061", and I observed that the solutions to these issues appear to involve correcting something within the SQL code. I'm encountering the "run-time error 3061" issue, but I'm not sure how to go about correcting the SQL. My hunch is that I have not properly constructed things to identify a date field, but I don't know how to correct this issue. In addition to not...
3
3514
by: laurentc via AccessMonster.com | last post by:
Hi. I have an issue with my Access project. I have rather big tables of data (about 11 000 rows). These tables are historical product quotations, so they are very simple : - MyDate (PrimaryKey) - Quote I do some calculations on these data:
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.