This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FW: Empty node set when namespace nodes are used


Hi,

I am trying to translate an input source file which contains a namespace
declaration and have problems with node match conditions when namespace
nodes are involved (for example: 
	<xsl:for-each select="TNMS:TNMSData/NEs/NE"> fails to produce a
nodeset.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- TNMS Export Start-Time: Fri, 12 Apr 2002, 10:24:16 -->
<!-- TNMS Server: 'V7-SERVER' -->
<?xml:stylesheet type="text/xsl"
href="C:\workspace\accessfiberimpl\corbainterface\interop\etc\stylesheets\tn
msData2afiop.xsl" ?>
<TNMSData xmlns="x-schema:C:\WINNT\TNMSDataSchema.xml">
<TNMSData>
	<!-- NEs -->
	<NEs>
		<!-- NE -->
		<NE IDName="WL8_1">
			<NEType
GUID="41286880-FC3C-11D4-B36C-000102B8B8D5"/>
			<ParentID EID="Dch: {NS1-QB3-Channel}"/>
			<PropContainer>
				<PropStore
GUID="43047833-19CA-42DD-944C-DC1BDF786649">
					<Property Name="AdminState"
Type="VT_I4">4</Property>
					<Property Name="NeLocation"
Type="VT_BSTR">GR02/Rack021/Subrack08/Einschub01(Oberg.)</Property>
					<Property Name="NeName"
Type="VT_BSTR">WLT8#01</Property>
					<Property Name="NeType"
Type="VT_BSTR">WLT 2.1-2.3</Property>
				</PropStore>
			</PropContainer>
		</NE>
	</NEs>
</TNMSData>

In my stylesheet, I try to extract all <NE> elements from the source file
and perform some transformations.

<xsl:stylesheet version="1.0" 
	
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
	
xmlns:TNMS="x-schema:C:\WINNT\TNMSRilSchema.xml">	
			
	<xsl:output method="xml" omit-xml-declaration="no" encoding="UTF-8"
indent="yes"/>


	<!-- omit the TNMS namespace in the accessFIBER XML files -->
	<xsl:namespace-alias stylesheet-prefix="TNMS"
result-prefix="#default"/>

	<xsl:template match="/">
	    <xsl:if test="TNMS:TNMSData/NEs">
		<AFIOPNetworkData
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
			<AFIOPCardcages>
				<xsl:for-each
select="TNMS:TNMSData/NEs/NE"><xsl:call-template
name="cardcageTemplate"/></xsl:for-each>
			</AFIOPCardcages>
		</AFIOPNetworkData>
		</xsl:if>
	</xsl:template>

============================================================================
==============

Upon debugging, I comment out the TNMS namespace declaration in the input
source file and remove all references to the TNMS namespace in my
stylesheet, then I don't run into any problems with my match conditions.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- TNMS Export Start-Time: Fri, 12 Apr 2002, 10:24:16 -->
<!-- TNMS Server: 'V7-SERVER' -->
<?xml:stylesheet type="text/xsl"
href="C:\workspace\accessfiberimpl\corbainterface\interop\etc\stylesheets\tn
msData2afiop.xsl" ?>
<TNMSData>
	<!-- NEs -->
	<NEs>
		<!-- NE -->
		<NE IDName="WL8_1">
			<NEType
GUID="41286880-FC3C-11D4-B36C-000102B8B8D5"/>
			<ParentID EID="Dch: {NS1-QB3-Channel}"/>
			<PropContainer>
				<PropStore
GUID="43047833-19CA-42DD-944C-DC1BDF786649">
					<Property Name="AdminState"
Type="VT_I4">4</Property>
					<Property Name="NeLocation"
Type="VT_BSTR">GR02/Rack021/Subrack08/Einschub01(Oberg.)</Property>
					<Property Name="NeName"
Type="VT_BSTR">WLT8#01</Property>
					<Property Name="NeType"
Type="VT_BSTR">WLT 2.1-2.3</Property>
				</PropStore>
			</PropContainer>
		</NE>
	</NEs>
</TNMSData>

Modified stylesheet:
<xsl:stylesheet version="1.0" 
	
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>	
			
	<xsl:output method="xml" omit-xml-declaration="no" encoding="UTF-8"
indent="yes"/>


	<xsl:template match="/">
	    <xsl:if test="TNMSData/NEs">
		<AFIOPNetworkData
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
			<AFIOPCardcages>
				<xsl:for-each
select="TNMSData/NEs/NE"><xsl:call-template
name="cardcageTemplate"/></xsl:for-each>
			</AFIOPCardcages>
		</AFIOPNetworkData>
		</xsl:if>
	</xsl:template>

 Can someone tell me what is going on?

-- Thanks.

Regards,
Trang

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]