Jump to content

Urgent :XSLT ErroR:NodeTest expected here


sireesha g

Recommended Posts

Hi All,I have an xml file like

<?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type="text/xsl" href="InProcess1.xsl"?> <Rowsets DateCreated="2011-02-14T12:24:00" EndDate="2011-02-14T12:24:00" StartDate="2011-02-14T11:24:00" Version="12.0.2 Build(88)"> <Rowset> <Columns>  <Column Description="BatchNumber" MaxRange="1" MinRange="0" Name="BatchNumber" SQLDataType="12" SourceColumn="BatchNumber" />   <Column Description="VersionCode" MaxRange="1" MinRange="0" Name="VersionCode" SQLDataType="3" SourceColumn="VersionCode" />   <Column Description="MaterialType" MaxRange="1" MinRange="0" Name="MaterialType" SQLDataType="12" SourceColumn="MaterialType" />   <Column Description="LotNumber" MaxRange="1" MinRange="0" Name="LotNumber" SQLDataType="4" SourceColumn="LotNumber" />   <Column Description="RRComplete" MaxRange="1" MinRange="0" Name="RRComplete" SQLDataType="-6" SourceColumn="RRComplete" />   <Column Description="ReviewerName" MaxRange="1" MinRange="0" Name="ReviewerName" SQLDataType="12" SourceColumn="ReviewerName" />   </Columns> <Row>  <BatchNumber>A12345</BatchNumber>   <VersionCode>1</VersionCode>   <MaterialType>Raw</MaterialType>   <LotNumber>12345</LotNumber>   <RRComplete>0</RRComplete>   <ReviewerName>ankit</ReviewerName>   </Row>  </Rowset>  </Rowsets>

and i applied xslt

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java"><xsl:template match="/">    <xsl:apply-templates select="Rowsets/Rowset"/></xsl:template><xsl:template match="Rowsets/Rowset"><html><head><title> In Process Batch Details </title><LINK href="Content.css" rel="stylesheet" type="text/css"/></head><body>><table cellpadding="0" cellspacing="0" width="100%" height="100%" border="2" class="ContentHeaderSection" ><tr><td>	<table width="60%" height="60%" class="Content" cellspacing="1" cellpadding="4" bordercolor="#FFFFFF" border="2" align="center" style="margin-top:120px;">		<tr>			<th colspan="2" class="ContentSubTitleBar ContentSubTitle">In Process Batch Details			</th>					</tr>		<tr>			<td>				<xsl:for-each select="Columns/Column">				<tr>										<td><xsl:value-of select="@Name"/></td>					<xsl:variable name="BatchDetails" select="@Name" />					[b]<td><xsl:value-of select="../../Row/$BatchDetails"/></td>[/b]				</tr>				</xsl:for-each>			</td>		</tr>	</table></td></tr></table></body></html></xsl:template></xsl:stylesheet>

My requriement is like i should loop through the columns and get the column name and to that column name mapping with rows i need to get the value of that row need to be displayed. <xsl:value-of select="../../Row/$BatchDetails"/> in the place of this if i give <xsl:value-of select="../../Row/BatchNumber"/>i am getting the output as

In Process Batch Details   BatchNumber A12345 VersionCode A12345 MaterialType A12345 LotNumber A12345 RRComplete A12345 ReviewerName A12345  

but if i give this <xsl:value-of select="../../Row/$BatchDetails"/>i am getting an error like NodeTest expected here. ../../Row/-->$<--BatchDetailsPlease help me if any one knows the xpath need to be given.Thanks and regards,Sireesha

Link to comment
Share on other sites

Hi All,I have an xml file like

<?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type="text/xsl" href="InProcess1.xsl"?> <Rowsets DateCreated="2011-02-14T12:24:00" EndDate="2011-02-14T12:24:00" StartDate="2011-02-14T11:24:00" Version="12.0.2 Build(88)"> <Rowset> <Columns>  <Column Description="BatchNumber" MaxRange="1" MinRange="0" Name="BatchNumber" SQLDataType="12" SourceColumn="BatchNumber" />   <Column Description="VersionCode" MaxRange="1" MinRange="0" Name="VersionCode" SQLDataType="3" SourceColumn="VersionCode" />   <Column Description="MaterialType" MaxRange="1" MinRange="0" Name="MaterialType" SQLDataType="12" SourceColumn="MaterialType" />   <Column Description="LotNumber" MaxRange="1" MinRange="0" Name="LotNumber" SQLDataType="4" SourceColumn="LotNumber" />   <Column Description="RRComplete" MaxRange="1" MinRange="0" Name="RRComplete" SQLDataType="-6" SourceColumn="RRComplete" />   <Column Description="ReviewerName" MaxRange="1" MinRange="0" Name="ReviewerName" SQLDataType="12" SourceColumn="ReviewerName" />   </Columns> <Row>  <BatchNumber>A12345</BatchNumber>   <VersionCode>1</VersionCode>   <MaterialType>Raw</MaterialType>   <LotNumber>12345</LotNumber>   <RRComplete>0</RRComplete>   <ReviewerName>ankit</ReviewerName>   </Row>  </Rowset>  </Rowsets>

and i applied xslt

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java"><xsl:template match="/">    <xsl:apply-templates select="Rowsets/Rowset"/></xsl:template><xsl:template match="Rowsets/Rowset"><html><head><title> In Process Batch Details </title><LINK href="Content.css" rel="stylesheet" type="text/css"/></head><body>><table cellpadding="0" cellspacing="0" width="100%" height="100%" border="2" class="ContentHeaderSection" ><tr><td>	<table width="60%" height="60%" class="Content" cellspacing="1" cellpadding="4" bordercolor="#FFFFFF" border="2" align="center" style="margin-top:120px;">		<tr>			<th colspan="2" class="ContentSubTitleBar ContentSubTitle">In Process Batch Details			</th>					</tr>		<tr>			<td>				<xsl:for-each select="Columns/Column">				<tr>										<td><xsl:value-of select="@Name"/></td>					<xsl:variable name="BatchDetails" select="@Name" />					[b]<td><xsl:value-of select="../../Row/$BatchDetails"/></td>[/b]				</tr>				</xsl:for-each>			</td>		</tr>	</table></td></tr></table></body></html></xsl:template></xsl:stylesheet>

My requriement is like i should loop through the columns and get the column name and to that column name mapping with rows i need to get the value of that row need to be displayed. <xsl:value-of select="../../Row/$BatchDetails"/> in the place of this if i give <xsl:value-of select="../../Row/BatchNumber"/>i am getting the output asIn Process Batch Details BatchNumber A12345 VersionCode A12345 MaterialType A12345 LotNumber A12345 RRComplete A12345 ReviewerName A12345 but if i give this <xsl:value-of select="../../Row/$BatchDetails"/>i am getting an error like NodeTest expected here. ../../Row/-->$<--BatchDetailsPlease help me if any one knows the xpath need to be given.Thanks and regards,Sireesha

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...