Page 1 of 1

Return all row Value

Posted: Mon Dec 30, 2013 9:21 am
by vivekfriend
Hi

I am using Oxygen XML Editor 15.1

There are 3 rows in one node element i.e. testnode

Now I need to fetch this rows data and display in a table (HTML)

Currently I a using following code:

Code: Select all

  <xsl:for-each select="/ns1:Resource/ns1:testpath/ns1:ExceptionMessage" xmlns:ns1="http://webservicepath">
<xsl:element name="tr">
<xsl:attribute name="align">center</xsl:attribute>

<xsl:element name="td">
<xsl:attribute name="align">left</xsl:attribute>
<font name="verdana" size="3">
<xsl:attribute name="width">120</xsl:attribute>
<i>
<xsl:value-of select="/ns1:Resource/ns1:testpath/ns1:ExceptionMessage/ns1:Message/text()" xmlns:ns1="http://webservicepath"/>
</i>
</font>
</xsl:element>
</xsl:element>
</xsl:for-each>
Now problem in above code is there are 3 rows in node so currently there are 3 rows display but value of all rows are same as first row value.

What is the problem?

Re: Return all row Value

Posted: Mon Jan 06, 2014 4:15 pm
by adrian
Hi,

The problem is the xsl:value-of/@select. Because you're using an absolute XPath inside the xsl:for-each, you are ignoring the current context (the current for-each item).
So, since the current context is an item from /ns1:Resource/ns1:testpath/ns1:ExceptionMessage, instead of:

Code: Select all

<xsl:value-of select="/ns1:Resource/ns1:testpath/ns1:ExceptionMessage/ns1:Message/text()" xmlns:ns1="http://webservicepath"/>
you should use:

Code: Select all

<xsl:value-of select="ns1:Message/text()" xmlns:ns1="http://webservicepath"/>
Regards,
Adrian

Re: Return all row Value

Posted: Thu Jan 09, 2014 8:10 am
by vivekfriend
Thankx adrian....

It's Work.... :)