XSL does not transforme correctly
I am using XSL within XML Spy Professional Edition to extract certain elements from an XML file called 'model.xml'.
The XSL code does not work.
Pasted below is the 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>
--------------------
Below is a snippet of the source XML file of relevance to this post:
--------------------
<?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 element near the end viz. 'queryItem' is the one I want to query. Within this element I want to output the PCDATA values for the 'name' sub element and 'columnName' sub element.
There are numerous occurrences of the 'queryItem' element.
Could you please let me know where I need to correct my code.
Thanks very much
Naveen

