javajoemorgan Posted May 19, 2008 Share Posted May 19, 2008 I'm writing some code to strip out elements from an xml based upon some rules. This part is working fine. After it is done, however, I need to determine if there are any elements left. For example, take this doc: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:str="http://exslt.org/strings"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> <!-- THIS IS COUNTING THE ORIGINAL NUMBER, NOT THE NEW NUMBER --> <xsl:if test="count(//*[local-name()='type']) = 0"> <!-- FORCE THE MESSAGE TO BE REJECTED --> </xsl:if> </xsl:template> <xsl:template match="*[local-name()='type']"> <!-- STRIPS OUT TYPES THAT DON'T BELONG - WORKS --> </xsl:template></xsl:stylesheet> Link to comment Share on other sites More sharing options...
javajoemorgan Posted May 20, 2008 Author Share Posted May 20, 2008 I figured it out. I had to first load the whole transform into a variable, and then test the contents of the variable. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.