Hi,
I am trying to create an XSL document which will output the word "Header" only if the <StepRecipeID > string for the current step is not equal to the <StepRecipeID > from previous steps. Thus, for the XML below, the word "Header" should be output twice (once for each of the two steps in the XML) since each step has a different string value for the <StepRecipeID >. Likewise, if the <StepRecipeID > 's were the same strings, the output would only be one "Header".
Does anyone know how to do this with the XSL?? I am trying to use XPath code within the XSL but I don't know if that is correct and I can't seem to figure it out. Any help would be much appreciated!!
Thank you!
Christine
XSL Code:
XML Code:
I am trying to create an XSL document which will output the word "Header" only if the <StepRecipeID > string for the current step is not equal to the <StepRecipeID > from previous steps. Thus, for the XML below, the word "Header" should be output twice (once for each of the two steps in the XML) since each step has a different string value for the <StepRecipeID >. Likewise, if the <StepRecipeID > 's were the same strings, the output would only be one "Header".
Does anyone know how to do this with the XSL?? I am trying to use XPath code within the XSL but I don't know if that is correct and I can't seem to figure it out. Any help would be much appreciated!!
Thank you!
Christine
XSL Code:
Code:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:for-each select="RecipeElement/Steps"> <xsl:if test="'Step/StepRecipeID' != 'previous::*'"> <t>Header </t> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet>
Code:
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="stylesheet13.xsl"?> <RecipeElement> <RecipeElementID>UFDF_CLEANING</RecipeElementID> <Steps> <InitialStep XPos="700" YPos="100"> <Name>INITIALSTEP:1</Name> </InitialStep> <TerminalStep XPos="50" YPos="50"> <Name>TERMINALSTEP:1</Name> </TerminalStep> <Step XPos="600" YPos="500" AcquireUnit="true"> <Name>Step 1</Name> <StepRecipeID>StepOne</StepRecipeID> <UnitAlias>UFDF_CLEANING:1</UnitAlias> </Step> <Step XPos="600" YPos="1000" AcquireUnit="true"> <Name>Step 2</Name> <StepRecipeID>StepTwo</StepRecipeID> <UnitAlias>UFDF_CLEANING:1</UnitAlias> </Step> </Steps> </RecipeElement>
Comment