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

XSL does not transform correctly

Subject: XSL does not transform correctly
From: nthalank@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 5 Dec 2005 16:05:24 -0500
bmtmodelspecification.xsd
Hello

I am quite new to the XSL technology.

I have used the built in XSLT engine of XML Spy Professional Engine version
5 as well as MSXML engine of Internet Explorer 6.0 XP SP2.

I experience the problem with both engines.

Problem Description


My XSL script does not extract information from the source XML file
correctly. Instead of extracting only the name of an element it extracts
everything.

XSL Script

Below is my XSL code:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/project/namespace/querySubject/queryItem">
<xsl:for-each select="columnName">
<p> <xsl:value-of select="text() " /></p>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


XML Code

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.developer.cognos.com/schemas/bmt/32/3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.developer.cognos.com/schemas/bmt/32/3
BMTModelSpecification.xsd">
	<name>XpoPlanTrak</name>
	<locales>
		<locale>en</locale>
	</locales>
	<defaultLocale>en</defaultLocale>
	<namespace>
		<name locale="en">XpoPlanTrak</name>
		<lastChanged>2005-11-17T11:08:00</lastChanged>
		<querySubject status="valid">
			<name locale="en">Xponent PlanTrak</name>
			<lastChanged>2005-11-14T16:02:27</lastChanged>
			<definition>
				<dbQuery>
					<sources>
	
<dataSourceRef>[].[dataSources].[XpoPlanTrak]</dataSourceRef>
					</sources>
					<sql type="cognos">Select   * from
[XpoPlanTrak].STG_XPO_PLANTRAK_MU</sql>
					<index>
						<unique>false</unique>
						<queryItems_collection>
	
<refobj>[XpoPlanTrak].[Xponent PlanTrak].[IMS_ID]</refobj>
						</queryItems_collection>
					</index>
					<index>
						<unique>false</unique>
						<queryItems_collection>
	
<refobj>[XpoPlanTrak].[Xponent PlanTrak].[PRODUCT_GROUP]</refobj>
						</queryItems_collection>
					</index>
				</dbQuery>
			</definition>
			<queryItem>
				<name locale="en">CLIENT_NBR</name>
	
<lastChanged>2005-11-14T16:02:06</lastChanged>
				<columnName>XPMU_CLIENT_NBR</columnName>
				<usage>fact</usage>
				<datatype>float64</datatype>
				<size>8</size>
				<nullable>true</nullable>
				<regularAggregate>sum</regularAggregate>
				<semiAggregate>sum</semiAggregate>
	
<collationSequenceName>OR_WE8ISO8859P1</collationSequenceName>
	
<collationSequenceLevel>2</collationSequenceLevel>
	
<originalEncodingName>WE8ISO8859P1</originalEncodingName>
                </queryItem>

The last element 'query item' is repeated multiple times.

Sample Output

Below is the output of the XSL transformation

XpoPlanTrakenenXpoPlanTrak2005-11-17T11:08:00Xponent
PlanTrak2005-11-14T16:02:27[].[dataSources].[XpoPlanTrak]Select * from
[XpoPlanTrak].STG_XPO_PLANTRAK_MUfalse[XpoPlanTrak].[Xponent
PlanTrak].[IMS_ID]false[XpoPlanTrak].[Xponent
PlanTrak].[PRODUCT_GROUP]CLIENT_NBR2005-11-14T16:02:06XPMU_CLIENT_NBRfactflo
at648truesumsumOR_WE8ISO8859P12WE8ISO8859P1REPORT_NBR2005-11-14T16:02:39XPMU
_REPORT_NBRfactfloat648truesumsumOR_WE8ISO8859P12WE8ISO8859P1IMS_SPECIALTY20
05-11-14T16:27:35XPMU_IMS_SPECIALTYattributecharacterLength161022trueunsuppo
rtedunsupportedOR_WE8ISO8859P12WE8ISO8859P1IMS_ID2005-11-17T10:58:12XPMU_IMS
_IDidentifiercharacterLength161022trueunsupportedunsupportedOR_WE8ISO8859P12
WE8ISO8859P1PLAN_ID2005-11-14T16:27:43XPMU_PLAN_IDattributecharacterLength16
1022trueunsupportedunsupportedOR_WE8ISO8859P12WE8ISO8859P1PAYMENT_TYPE2005-1
1-14T16:27:52XPMU_PAYMENT_TYPEattributecharacterLength161022trueunsupportedu
nsupportedOR_WE8ISO8859P12WE8ISO8859P1CATEGORY2005-11-14T16:27:58XPMU_CATEGO
RYfactfloat648truesumsumOR_WE8ISO8859P12WE8ISO8859P1RX_TYPE2005-11-14T16:35:
43XPMU_RX_TYPEattributecharacterLength1614trueunsupportedunsupportedOR_WE8IS
O8859P12WE8ISO8859P1PRODUCT_GROUP2005-11-14T16:35:52XPMU_PRODUCT_GROUPidenti
fierfloat648truecountunsupportedOR_WE8ISO8859P12WE8ISO8859P1PRESCRIBER_NBR20
05-11-14T16:35:59XPMU_PRESCRIBER_NBRattributecharacterLength161022trueunsupp
ortedunsupportedOR_WE8ISO8859P12WE8ISO8859P1DATA_DATE2005-11-14T16:36:04XPMU
_DATA_DATEattributecharacterLength16614trueunsupportedunsupportedOR_WE8ISO88
59P12WE8ISO8859P1NEW_RX_012005-11-14T16:48:03XPMU_NEW_RX_01factfloat648trues
umsumOR_WE8ISO8859P12WE8ISO8859P1NEW_RX_022005-11-14T16:48:12XPMU_NEW_RX_02f
actfloat648truesumsumOR_WE8ISO8859P12WE8ISO8859P1NEW_RX_032005-11-14T16:48:5
1XPMU_NEW_RX_03factfloat648truesumsumOR_WE8ISO8859P12WE8ISO8859P1NEW_RX_0420
05-11-14T16:49:00XPMU_NEW_RX_04factfloat648truesumsumOR_WE8ISO8859P12WE8ISO8
859P1NEW_RX_052005-11-14T16:49:11XPMU_NEW_RX_05factfloat648truesumsumOR_WE8I
SO8859P12WE8ISO8859P1NEW_RX_062005-11-14T16:49:22XPMU_NEW_RX_06factfloat648t
ruesumsumOR_WE8ISO8859P12WE8ISO8859P1NEW_RX_072005-11-17T10:45:56XPMU_NEW_RX
_07factfloat648truesumsumOR_WE8ISO8859P12WE8ISO8859P1NEW_RX_082005-11-17T10:
46:01XPMU_NEW_RX_08factfloat648truesumsumOR_WE8ISO8859P12WE8ISO8859P1NEW_RX_
092005-11-17T10:46:07XPMU_NEW_RX_09factfloat648truesumsumOR_WE8ISO8859P12WE8
ISO8859P1NEW_RX_102005-11-17T10:46:13XPMU_NEW_RX_10factfloat648truesumsumOR_
WE8ISO8859P12WE8ISO8859P1NEW_RX_112005-11-17T10:46:19XPMU_NEW_RX_11factfloat
648truesumsumOR_WE8ISO8859P12WE8ISO8859P1NEW_RX_122005-11-17T10:46:26XPMU_NE
W_RX_12factfloat648truesumsumOR_WE8ISO8859P12WE8ISO8859P1NEW_RX_132005-11-17
T10:46:31XPMU_NEW_RX_13factfloat648truesumsumOR_WE8ISO8859P12WE8ISO8859P1NEW
_RX_142005-11-

Expected Output


XPMU_CLIENT_NBR
XPMU_REPORT_NBR
XPMU_IMS_SPECIALTY
XPMU_IMS_ID
XPMU_PLAN_ID
XPMU_PAYMENT_TYP
XPMU_CATEGORY
XPMU_RX_TYPE
XPMU_PRODUCT_GROUP
...
....

...

Thanks in advance



Regards

Naveen K Thalanki
Principal Software Engineer (IT Commercial Systems)
Boehringer Ingelheim Pharmaceuticals
Tel : 203 798  4630
Fax: 203 791 6601

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.