RigasMinho wrote:
However I only want it to grab certain objects with a
certain tag on them.
And the problem is..?
XML file has:
<infoObject>
<infoObjectDetail title='Field'>Test
Field</infoObjectDetail>
<infoObjectDetail title='Description'>Test
Desc</infoObjectDetail>
<infoObjectDetail title='Object'>Test
Object</infoObjectDetail>
<infoObjectDetail title='Source'>Test
Source</infoObjectDetail>
</infoObject>
XSL file:
<xsl:for-each select="infoObjectDetail">
<td><xsl:value-of select="." / </td>
</xsl:for-each>
I want it so that it skips over the field of
"Description" and moves onto the next field. I've looked
for a for loop to do this but havent had any luck.
Any ideas?
Lots, actually. First of all, I would recommend reading
some XSLT and XPath tutorials.
As to your problem, you could either persist in your
attempts to stick imperative paradigm to XSLT and use the
following:
<xsl:if test="@title!='Description'">
<td><xsl:value-of select="." / </td>
</xsl:if>
....or you could try to adapt and do the Right Thing. Drop
for-each, define a template:
<xsl:template match="infoObjectDetail">
<td><xsl:value-of select="."/> </td>
</xsl:template>
Then use apply-templates to process the nodes you need.
<xsl:apply-templates
select="//infoObjectDetail[@title!='Description']"/>
Or even better, select all the nodes, and use predicates to
define corresponding templates (empty template for
infoObjectDetail[@title='Description'] etc.)
And the last thing: read some XSLT and XPath tutorials.
Toying with Lisp or Scheme or [foo nctional language of
your choice] is also highly recommended.
Oh, and forget the 'for loops'.
Did I mention tutorials?
--
Pavel Lepin