• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XSL Transformation Error

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I am fairly new to the XSL world.. So, any help would be much appreciated.
I am trying to perform an XML to XML conversion using an XSL. I am showing the problem part of the XSL below.

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.0.1 U (http://www.xmlspy.com) -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:element name="Request">
<xsl:element name="ABCForm">
<xsl:attribute name="srcTagIndex">-1</xsl:attribute>
<xsl:attribute name="xsi:type">HI</xsl:attribute>
-------------------------------------
The error I get is ...
SystemId Unknown; Line 8; Column 36; Could not resolve namespace prefix: xsi. The node will be ignored.
--------------------------------------
If I replace the "xsi:type" with a random string, such as "abcd", it doesn't complain and gives me the desired XML Output.. a new attribute with value "abcd".
thanks!
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In order to refer to the XSI namespace, you need to "map" it to the prefix "xsi":

(not sure if I remembered the schema URL 100% correct)
 
Himanshu Jhamb
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot ! That fixed it. And yes, you do remember the schema correctly !
I have another question...
My result XML contains a bunch of CONTROL-I characters wherever I specified CDATA usage in my xsl.
For example, here's a sample of my xsl file...
<xsl:element name="VER">
<xsl:attribute name="srcTag">S7</xsl:attribute>
<xsl:attribute name="xmlPath">LSR/1/ADM/1/VER/1</xsl:attribute>
<![CDATA[AA]]></xsl:element>
------------------------------
Produces the following result
------------------------------
<VER srcTag="S7" xmlPath="LSR/1/ADM/1/VER/1">$
^I^I^I^I^I^IAA</VER>$
These Control Characters are killing my code later on... Any idea(s) why the CDATA is doing this ? Am I using it correctly?
Thanks in Advance!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic