0

I'm having a XSLT problem.

I am reading from one xml sheet and creating another using XSLT. The final transformed XML has an element <Recreations> that contains <Recreation> elements. I am using <xsl:for-each> to create the <Recreation> elements. So my xslt looks something like this:

<Recreations>
<xsl:for-each select="MyItems">
<xsl:if select="cust:isThisARecreation(@Description)>
<Recreation>
<xsl:value-of select="@Description">
</Recreation>
</xsl:if>
</xsl:for-each>
</Recreations>

So: isThisARecreation function is a custom Java function. The <Recreations> element could contain zero to many <Recreation> elements. If there are no <Recreation> elements then I have to remove the <Recreations> element.

I have to go through the loop to know if there are Recreation elements. If there aren't I don't need it's parent element. Anyone have any ideas on how I might do this?

Thanks,
Ben

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by xml_looser
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.