We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
Tags:
create new tag
, view all tags

XmlQueryPluginRecipe1

List all Attachments in the current Web

Annotated XSLT

%XSLTSTART{topic=".*" benchmark="off" cache="on" debug="on"}%
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

Required XSL header tag

 <xsl:template match="/twiki">

Match each /twiki item in the XML

 <table border="1">
 <tr><th>Topic</th><th>Attachment</th><th>User</th><th>Comment</th></tr>
Output a table tag and the contents of the first row


 <xsl:for-each select="/twiki/web/topic/data/metadata/fileattachment">
Loop over each fileattachment

   <tr>
   <td>[[<xsl:value-of select="../../@web"/>.<xsl:value-of select="../../@topic"/>]]</td>
Extract from the XML element "data" the web and topic attributes

   <td><xsl:value-of select="@name"/></td>
   <td><xsl:value-of select="@user"/></td>
   <td><xsl:value-of select="@comment"/></td>

Output the file attachment attributes of name, user and comment


   <p/>
  </tr>
  </xsl:for-each>
  </table>
  </xsl:template>
  </xsl:stylesheet>
%XSLTEND%

XSLT Demo

XmlQuery must be Installed for this demo to work. If %XSLTSTART{}% tag appears XmlQueryPugin is not installed

%XSLTSTART{topic=".*" benchmark="off" cache="on" debug="off"}%

<xsl:for-each select="/twiki/web/topic/data/metadata/fileattachment">

</xsl:for-each>
TopicAttachmentUserComment
<xsl:value-of select="../../@web"/>.<xsl:value-of select="../../@topic"/>? <xsl:value-of select="@name"/> <xsl:value-of select="@user"/> <xsl:value-of select="@comment"/>
%XSLTEND%
Topic revision: r2 - 13 Feb 2006 - 17:06:31 - PatrickDiamond
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback