Add new attachment

Only authorized users are allowed to upload new attachments.

This page (revision-58) was last changed on 03-Mar-2011 11:02 by Janne Jalkanen  

This page was created on 23-May-2006 22:17 by 84.192.36.248

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 4 changed one line
|Submitter|84.192.36.248
|Submitter| [DF|DirkFrederickx]
At line 9 changed one line
todo
%%tabbedsection
%%tab-Proposal
!! Wiki Link syntax extended with XPATH
See also [XPath]
This page describes an approach to extend the wiki [[link syntax]
to powerful expressions based on XPATH and JSR-170.
It would also allow to add subpages to JSPWiki.
Example of current syntax :
{{{
[SandBox] =>yield link to wiki page
[SandBox/attach.jpg] =>yield link to attachment
}}}
Example of extended Wiki Link syntax :
{{{
[SandBox/w:properties/variableX] =>yield value of wiki variable
[SandBox/w:versions/v123] =>yield link to wiki page version
[SandBox/w:versions/v123/attach.jpg] =>yield link to attachment
[SandBox/@variableX] =>yield value of wiki variable
[SandBox/v123/attach.jpg] =>yield link to attachment
}}}
Normally, the wiki link syntax returns a single result, being a link to a wiki page or attachment.
From the previous examples, you can see that it is also possible to return the value of page __variables__ as well as links to page __versions__ different from the latest version.
Additionally, XPATH expressions will allow to return multiple results, separated by a space.
{{{
[SandBox/w:to] =>yield all referred-to page links
[SandBox/w:from] =>yield all referred-from page links
[SandBox/w:versions] =>yield links to all versions of SandBox
[SandBox/w:properties] =>yield all variables (how? name=value)
[SandBox/w:attachments] =>yield all attachment links
}}}
!! Wiki Metadata XML model
A Wiki Link can be written be means of an [XPATH] expression.
In order to do that, you need to understand the underlying xml model.
The namespace ''w;'' is preserved for the predefined wiki elements.
\\''TODO: check how this will work with interwiki links.''
{{{
<w:pages>
<aPage1>
<w:author> ... </w:author>
<w:created> ... </w:created>
<w:pageName> ... </w:pageName>
<w:lastModified> ... </w:lastModified>
<w:versionNumber> ... </w:versionNumber>
<w:properties>
<aProperty1> ... </aProperty1>
<aProperty2> ... </aProperty2>
</w:properties>
<w:attachments>
<anAttachment1>
<w:fileName> ... </w:fileName>
<w:fileSize> ... </w:fileSize>
</anAttachment1>
</w:attachments>
<w:versions>
<v1> ... </v1>
<v2> ... </v2>
<v3> ... </v3>
</w:versions>
<w:to>
<aPageX1> ... </aPageX1>
<aPageX2> ... </aPageX2>
</w:to>
<w:from>
<aPageY1> ... </aPageY1>
<aPageY2> ... </aPageY2>
</w:from>
... <pagecontent - wiki markup text> ...
</aPage1>
<aPage2> ... <aPage2>
</w:pages>
}}}
Shortcut syntax is defined for properties, attachments and versions.
Also the root-path {{/w:pages/}} can be dropped. This way, the syntax
becomes backwards compatible with the current syntax.
{{{
/w:pages/SandBox/w:properties/versionLabel
=> SandBox/@versionLabel
/w:pages/SandBox/w:attachments/attach.png
=> SandBox/attach.png
/w:pages/SandBox/w:versions/v127/w:properties/versionLabel
=> SandBox/v127/@versionLabel
}}}
!! XPATH expression
XPATH expression allow for a powerful querying of the wiki repository.
(See [XPATH] for more details)
Some examples:
Return a list of to-pages having a fruit variable
{{{
[SandBox/w:to[@fruit]]
}}}
Return a list of to-pages where the fruit variable equals 'apple'
{{{
[SandBox/w:to[@fruit='apple']]
}}}
Use (brackets) when you need logical operators (avoid syntax ambiguity)
{{{
[(SandBox/w:to[@fruit='apple'] | SandBox/w:to[@fruit='approved'])]
}}}
XPATH evens supports string functions. Following example returns a
list of pages with the search string matched
{{{
[SandBox/w:to[contains(text(),'jsp')]]
[SandBox/w:from[starts-with('Description')]]
}}}
!Implementation
It should be possible to use a standard xpath processing java library as a plugin to wiki to support this kind of expressions.
Probably, we need to write some back-end to provide the xpath with a ''virtual'' xml structure to mimic the internal repository of JSPWiki.
Ref. [JXPATH] Apache library. Check it.
!! Wiki Link Format
With the extended syntax, a wiki link can now return
(i) a hyperlink, (ii) a variable value, (iii) a set of hyperlinks or (iv) a set of values.
Therefor additional formatting capabilities are needed.
Standard __wiki link format__ syntax allows a static ''format'' text.
{{{
[Play around|Sandbox]
}}}
More elaborated format string allows to reference variables inside the referenced page
or attachement.
{{{
[Speed is @speed|Sandbox]
[@filesize|Sanbox/attach.png]
}}}
In case the wiki link return multiple results, the format string is iterated over each result.
Example: following expression returns a bullet list of pages with the value of @liveVersion
and a link to that page as well.
use {{.}} to refer to the iterated result of the wiki-path
{{{
[* @pagename has version @liveVersion, here is the [link|.] |Sandbox/w:to]
}}}
Use page variables (prefixed with $) to replace more complex format strings.
{{{
[{SET formatAuthor='Author of @pagename is @author' }]
[$formatAuthor|Sandbox/w:to]
}}}
{{{
[{SET format='* ./$pagename has version ./$liveVersion, here is the [link|.]' }]
[[{$format}]|wiki-path]
idem, with format string defined in $format of this page
[[SandBox/$format]|wiki-path]
idem, with format string defined in $format of the Main page
|| PageName || LiveVersion || Link
[{| ./$pagename | ./$liveVersion | [link|.] }|wiki-path]
idem, with table header and table body as output format
}}}
%%
%%tab-Discussion
Please log your remarks/suggestions here
%%
%%
Version Date Modified Size Author Changes ... Change note
58 03-Mar-2011 11:02 25.952 kB Janne Jalkanen to previous
57 28-Feb-2011 12:32 26.856 kB illetidly to previous | to last
56 27-Feb-2011 13:51 26.206 kB trevib to previous | to last
55 27-Feb-2011 12:38 26.077 kB britneyw to previous | to last
54 05-Feb-2011 10:50 25.952 kB Harry Metske to previous | to last removed spam
53 03-Feb-2011 12:45 26.189 kB neverstoper to previous | to last
52 26-Sep-2007 23:00 25.952 kB JanneJalkanen to previous | to last
51 26-Sep-2007 01:35 25.964 kB 219.138.204.162 to previous | to last
50 12-Oct-2006 11:16 25.952 kB JanneJalkanen to previous | to last
49 10-Oct-2006 12:30 26.132 kB halloween to previous | to last remove spam
48 09-Oct-2006 15:12 25.952 kB 212.123.14.6 to previous | to last remove spam
47 09-Oct-2006 14:02 26.138 kB dresses to previous | to last
46 18-Jun-2006 11:46 25.952 kB Dirk Frederickx to previous | to last
45 27-May-2006 15:16 16.641 kB Dirk Frederickx to previous | to last
44 27-May-2006 15:16 16.641 kB Dirk Frederickx to previous | to last
43 26-May-2006 12:04 15.931 kB Rolf Schumacher to previous | to last
42 26-May-2006 12:04 16.055 kB Rolf Schumacher to previous | to last
41 26-May-2006 12:03 16.029 kB Rolf Schumacher to previous | to last
« This page (revision-58) was last changed on 03-Mar-2011 11:02 by Janne Jalkanen