• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help Needed! New to Xml and XSl coding

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am to create an XSLT that will output the records found under the ‘<dme:FetchDocumentList.Response>’ node into an HTML numbered result list. I have the following XML file. Any help will be appreciated.
I have pasted my attempt at the bottom of the page. thanks

<?xml version="1.0" encoding="ISO-8859-1"?>

<dme:WfMessage Version="1.1" xmlns:dme="dme">
<dme:WfTransport>
<dme:Connection Mode="individual" Type="synch" />
</dme:WfTransport>
<dme:WfMessageHeader>
<dme:Response />
</dme:WfMessageHeader>
<dme:WfMessageBody>
<dme:FetchDocumentList.Response>
<dme:Document>
<dme:ID>136</dme:ID>
<dme:DOC_CLASS>MEDIA</dme:DOC_CLASS>
<dme:DOC_NUMBER>3166</dme:DOC_NUMBER>
<dme:REVISION>3</dme:REVISION>
<dme:DIS_MEDIA_CAT>PICTURE</dme:DIS_MEDIA_CAT>
<dme:IL_POC>Craig</dme:IL_POC>
<dme:IL_TITLE>White Monkey</dme:IL_TITLE>
<dme:DIS_FILETYPE>JPEG</dme:DIS_FILETYPE>
<dme:IL_POSTDATE>1045238867710</dme:IL_POSTDATE>
<dme:IL_DOCID>P33333S</dme:IL_DOCID>
<dme:IL_KEYWORD>Monkey</dme:IL_KEYWORD>
<dme:IL_COUNTRY />
<dme:IL_SUBCODE_IFC />
<dme:IL_SECUR_NONUS_CLASSIF>TS</dme:IL_SECUR_NONUS_CLASSIF>
<dme:IL_SECUR_RELTO>AUS/CAN/NZ/UK/US</dme:IL_SECUR_RELTO>
<dme:HITLIST_VIEW />
<dme:Security>
<CONTENT_VIEW>1</CONTENT_VIEW>
<CATALOG_VIEW>1</CATALOG_VIEW>
<HISTORY_VIEW>1</HISTORY_VIEW>
<RESERVED_VIEW>1</RESERVED_VIEW>
<CONTENT_EDIT>1</CONTENT_EDIT>
<CATALOG_EDIT>1</CATALOG_EDIT>
<ANNOTATE>1</ANNOTATE>
<SECURITY_EDIT>1</SECURITY_EDIT>
<ANNOTATE_VIEW>1</ANNOTATE_VIEW>
</dme:Security>
</dme:Document>
<dme:Document>
<dme:ID>137</dme:ID>
<dme:DOC_CLASS>MEDIA</dme:DOC_CLASS>
<dme:DOC_NUMBER>3235</dme:DOC_NUMBER>
<dme:REVISION>1</dme:REVISION>
<dme:DIS_MEDIA_CAT>PICTURE</dme:DIS_MEDIA_CAT>
<dme:IL_POC>Brian Peterson</dme:IL_POC>
<dme:IL_TITLE>SUNSET IN CALIFORNIA</dme:IL_TITLE>
<dme:DIS_FILETYPE>JPEG</dme:DIS_FILETYPE>
<dme:IL_POSTDATE>1045491585360</dme:IL_POSTDATE>
<dme:IL_DOCID>908934NI3990</dme:IL_DOCID>
<dme:IL_KEYWORD>SAMPLE SUNSET</dme:IL_KEYWORD>
<dme:IL_COUNTRY />
<dme:IL_SUBCODE_IFC />
<dme:IL_SECUR_NONUS_CLASSIF>TS</dme:IL_SECUR_NONUS_CLASSIF>
<dme:IL_SECUR_RELTO>UK</dme:IL_SECUR_RELTO>
<dme:HITLIST_VIEW />
<dme:Security>
<CONTENT_VIEW>1</CONTENT_VIEW>
<CATALOG_VIEW>1</CATALOG_VIEW>
<HISTORY_VIEW>1</HISTORY_VIEW>
<RESERVED_VIEW>1</RESERVED_VIEW>
<CONTENT_EDIT>1</CONTENT_EDIT>
<CATALOG_EDIT>1</CATALOG_EDIT>
<ANNOTATE>1</ANNOTATE>
<SECURITY_EDIT>1</SECURITY_EDIT>
<ANNOTATE_VIEW>1</ANNOTATE_VIEW>
</dme:Security>
</dme:Document>
<dme:Document>
<dme:ID>138</dme:ID>
<dme:DOC_CLASS>MEDIA</dme:DOC_CLASS>
<dme:DOC_NUMBER>3236</dme:DOC_NUMBER>
<dme:REVISION>1</dme:REVISION>
<dme:DIS_MEDIA_CAT>PICTURE</dme:DIS_MEDIA_CAT>
<dme:IL_POC>Brian Peterson</dme:IL_POC>
<dme:IL_TITLE>Winter scene</dme:IL_TITLE>
<dme:DIS_FILETYPE>JPEG</dme:DIS_FILETYPE>
<dme:IL_POSTDATE>1045491652920</dme:IL_POSTDATE>
<dme:IL_DOCID>E4323452345234</dme:IL_DOCID>
<dme:IL_KEYWORD>WINTER</dme:IL_KEYWORD>
<dme:IL_COUNTRY />
<dme:IL_SUBCODE_IFC />
<dme:IL_SECUR_NONUS_CLASSIF>TS</dme:IL_SECUR_NONUS_CLASSIF>
<dme:IL_SECUR_RELTO>UK</dme:IL_SECUR_RELTO>
<dme:HITLIST_VIEW />
<dme:Security>
<CONTENT_VIEW>1</CONTENT_VIEW>
<CATALOG_VIEW>1</CATALOG_VIEW>
<HISTORY_VIEW>1</HISTORY_VIEW>
<RESERVED_VIEW>1</RESERVED_VIEW>
<CONTENT_EDIT>1</CONTENT_EDIT>
<CATALOG_EDIT>1</CATALOG_EDIT>
<ANNOTATE>1</ANNOTATE>
<SECURITY_EDIT>1</SECURITY_EDIT>
<ANNOTATE_VIEW>1</ANNOTATE_VIEW>
</dme:Security>
</dme:Document>
<dme:FetchDocumentFrom>0</dme:FetchDocumentFrom>
<dme:FetchDocumentCount>3</dme:FetchDocumentCount>
<dme:FetchDocumentFetchSize>0</dme:FetchDocumentFetchSize>
<dme:FetchDocumentTotalCount>3</dme:FetchDocumentTotalCount>
<dme:COMPLETION>0</dme:COMPLETION>
</dme:FetchDocumentList.Response>
</dme:WfMessageBody>
</dme:WfMessage>

XSL code

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:template match="/">
<html>
<body>
<h2>Question 2</h2>
<h2></h2>
<table border="1">
<tr >
<th>Title</th>
<th>Artist</th>
</tr>
<tr>
<td><xsl:value-of select="dme:WfMessage/dme:WfMessageBody/dme:FetchDocumentList.Response/dme:Document/dme:ID"/></td>

</tr>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions">


You have to add the namespace declaration for the prefix dme. Also a little addition of an attribute exclude-result-prefixes may help to obtain a cleaner output.

ps: Unless you are engaging in some template using xpath-function namespace, you do not need the xmlns:fn part here. And even so, xslt version 1.0 strict won't support it. But this really is a side-note as far as your question is concerned.
 
femi alaran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your response I will try it. see how far I get.
Can you show an example what you are talking about am new to this?
thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic