Question

Locked

Does anyone have any XSLT knowledge?

By jutpro ·
Does anyone have any XSLT knowledge?

Need help with an XSLT style sheet. Below is a copy of the style sheet and the XML document respectively. The first sections of the style sheet works fine but the section that has the ?<xsl:for-each>? element is not working at all. This section is suppose to loop and select all the child elements for each ?operation? element, but instead that entire section is being ignored and no transformation is happening.

I am using an XML software I downloaded from the internet call the Exchanger to aid me in the transformation. It is not giving me any errors so I am not sure what I am doing wrong.


XSLT Style Sheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">

<xsl:text>
The following error has occurred on Process ID </xsl:text><xsl:value-of select="//wf_id"/>
<xsl:text>
BP Event Details</xsl:text>
<xsl:text>
==============================================================================</xsl:text>
<xsl:text>
EVENT type: </xsl:text><xsl:value-of select="DETAILED_DATA/EVENT/@type"/>
<xsl:text>
WF_I </xsl:text><xsl:value-of select="DETAILED_DATA/EVENT/wf_id"/>
<xsl:text>
WF status: </xsl:text><xsl:value-of select="DETAILED_DATA/EVENT/wf_status"/>
<xsl:text>
WorkFlow: </xsl:text><xsl:value-of select="DETAILED_DATA/EVENT/WorkFlow"/>
<xsl:text>
WF State: </xsl:text><xsl:value-of select="DETAILED_DATA/EVENT/wf_state"/>
<xsl:text>
WF State String: </xsl:text><xsl:value-of select="DETAILED_DATA/EVENT/wf_state_string"/>
<xsl:text>
==============================================================================
</xsl:text>
<xsl:text>
Workflow Details</xsl:text>
<xsl:text>
==============================================================================</xsl:text>

End Time: </xsl:text><xsl:value-of select="//workflow/@end-time"/>
<xsl:text>
Process I </xsl:text><xsl:value-of select="//workflow/@id"/>
<xsl:text>
BP Name : </xsl:text><xsl:value-of select="//workflow/@name"/>
<xsl:text>
Start Time: </xsl:text><xsl:value-of select="//workflow/@start-time"/>
<xsl:text>
State: </xsl:text><xsl:value-of select="//workflow/@state"/>
<xsl:text>
Status: </xsl:text><xsl:value-of select="//workflow/@status"/>
<xsl:text>
==============================================================================
</xsl:text>
<xsl:text>
Operations Details</xsl:text>
<xsl:for-each select="/operations/operation">
<xsl:text>
==============================================================================</xsl:text>
<xsl:text>
WFC I </xsl:text><xsl:value-of select="wfc-id"/>
<xsl:text>
Service Name: </xsl:text><xsl:value-of select="service-name"/>
<xsl:text>
Service Parm Version: </xsl:text><xsl:value-of select="service-parm-version"/>
<xsl:text>
Sub Process: </xsl:text><xsl:value-of select="sub-process"/>
<xsl:text>
Basic Status: </xsl:text><xsl:value-of select="basic-status"/>
<xsl:text>
Advance Status: </xsl:text><xsl:value-of select="advance-status"/>
<xsl:text>
Start Time: </xsl:text><xsl:value-of select="start-time"/>
<xsl:text>
End Time: </xsl:text><xsl:value-of select="end-time"/>
<xsl:text>
Status Report </xsl:text><xsl:value-of select="status-report"/>
<xsl:text>
Document: </xsl:text><xsl:value-of select="status-report"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


XML File:
<?xml version="1.0" encoding="UTF-8"?><DETAILED_DATA><EVENT type="BUSINESS_PROCESS"><wf_id>15078732</wf_id><wf_status>1</wf_status><WorkFlow>com.woodstock.workflow.WorkFlow@80d812</WorkFlow><wf_state>1</wf_state><wf_state_string>COMPLETE</wf_state_string></EVENT><workflow end-time="12/01/08 8:18:32 AM" id="15078732" name="PROD_856" start-time="12/01/08 8:18:31 AM" state="Label.Completed" status="ERROR"><operations><operation step="0"><wfc-id>prod:7a84e4:11df2b24bdb:-7d34</wfc-id><service-name>FileSystemAdapter</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.067</start-time><end-time>2008-12-01 08:18:31.067</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="1"><wfc-id>prod:7a84e4:11df2b24bdb:-7b7c</wfc-id><service-name>Timestamp Utility Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.16</start-time><end-time>2008-12-01 08:18:31.177</end-time><status-report>Action: format

The format string is yyyyMMddHHmm.
The input time stamp in milliseconds is 1228137511161.
The input time stamp after formatted is 200812010818.</status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="2"><wfc-id>prod:7a84e4:11df2b24bdb:-7b69</wfc-id><service-name>Assign Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.177</start-time><end-time>2008-12-01 08:18:31.177</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="3"><wfc-id>prod:7a84e4:11df2b24bdb:-7b3b</wfc-id><service-name>Assign Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.193</start-time><end-time>2008-12-01 08:18:31.193</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="4"><wfc-id>prod:7a84e4:11df2b24bdb:-7b12</wfc-id><service-name>Assign Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.193</start-time><end-time>2008-12-01 08:18:31.207</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="5"><wfc-id>prod:7a84e4:11df2b24bdb:-7adb</wfc-id><service-name>Assign Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.223</start-time><end-time>2008-12-01 08:18:31.223</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="6"><wfc-id>prod:7a84e4:11df2b24bdb:-7a1b</wfc-id><service-name>PROD_FSA</service-name><service-parm-version>3</service-parm-version><sub-process>None</sub-process><basic-status>Error</basic-status><advance-status>java.io.IOException: Cannot create directory C:\PROD\ARCHIVE\OUT\856</advance-status><start-time>2008-12-01 08:18:31.24</start-time><end-time>2008-12-01 08:18:31.317</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="7"><wfc-id>prod:7a84e4:11df2b24bdb:-7a0a</wfc-id><service-name>Decision Engine Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status>9</advance-status><start-time>2008-12-01 08:18:31.317</start-time><end-time>2008-12-01 08:18:31.317</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="8"><wfc-id>prod:7a84e4:11df2b24bdb:-79f6</wfc-id><service-name>Assign Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.333</start-time><end-time>2008-12-01 08:18:31.333</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="9"><wfc-id>prod:7a84e4:11df2b24bdb:-79db</wfc-id><service-name>System Invoke Business Process Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status>Inline Begin PROD_Email_Error</advance-status><start-time>2008-12-01 08:18:31.35</start-time><end-time>2008-12-01 08:18:31.507</end-time><status-report></status-report></operation><operation step="10"><wfc-id>prod:7a84e4:11df2b24bdb:-79e1</wfc-id><service-name>This Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.537</start-time><end-time>2008-12-01 08:18:31.537</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="11"><wfc-id>prod:7a84e4:11df2b24bdb:-794a</wfc-id><service-name>Assign Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.567</start-time><end-time>2008-12-01 08:18:31.567</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="12"><wfc-id>prod:7a84e4:11df2b24bdb:-7925</wfc-id><service-name>Assign Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.583</start-time><end-time>2008-12-01 08:18:31.583</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="13"><wfc-id>prod:7a84e4:11df2b24bdb:-790d</wfc-id><service-name>Assign Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.583</start-time><end-time>2008-12-01 08:18:31.583</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7d36</document></operation><operation step="14"><wfc-id>prod:7a84e4:11df2b24bdb:-78f4</wfc-id><service-name>XML Encoder Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.6</start-time><end-time>2008-12-01 08:18:31.6</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-78f0</document></operation><operation step="15"><wfc-id>prod:7a84e4:11df2b24bdb:-78d1</wfc-id><service-name>XSLT Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.63</start-time><end-time>2008-12-01 08:18:31.63</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-78cd</document></operation><operation step="16"><wfc-id>prod:7a84e4:11df2b24bdb:-78ba</wfc-id><service-name>SMTP Send Adapter</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status></advance-status><start-time>2008-12-01 08:18:31.647</start-time><end-time>2008-12-01 08:18:32.113</end-time><status-report></status-report><document>prod:7a84e4:11df2b24bdb:-7856</document></operation><operation step="17"><wfc-id>prod:7a84e4:11df2b24bdb:-7815</wfc-id><service-name>System Invoke Business Process Service</service-name><service-parm-version>0</service-parm-version><sub-process>None</sub-process><basic-status>Success</basic-status><advance-status>Inline End</advance-status><start-time>2008-12-01 08:18:31.647</start-time><end-time>2008-12-01 08:18:32.113</end-time><status-report></status-report></operation></operations></workflow></DETAILED_DATA>

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Xpath is wrong

by Tony Hopkinson In reply to Does anyone have any XSLT ...

/Operations/Operation
is looking from document root. So it's working there just aren't any.

I suspect if you just drop the initial / it will work, can't say exactly because your xml fragment doesn't appear to be properly formed. opening workflow tag looks missing.

Collapse -

That sure did it

by jutpro In reply to Xpath is wrong

Thank you very much, Tony. I appreciate your help.

Collapse -

Glad to help.

by Tony Hopkinson In reply to That sure did it

He says with a foolish grin, waving an upturned thumb as a hint.

Back to Networks Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums