Created
February 4, 2013 08:50
-
-
Save hfs/4705692 to your computer and use it in GitHub Desktop.
XSLT stylesheet to convert a JIRA bug list in XML format into a plain text table in TWiki format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Stylesheet to convert a JIRA report list exported as XML into a table in | |
TWiki's plaintext format. | |
The table contains these columns: | |
- ID: Issue ID with link to issue page | |
- summary | |
- priority: Numerical priority – smaller number is more important | |
- component: one ore more, divided by </br> | |
- created: date of creation | |
--> | |
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform"> | |
<output method="text" indent="yes"/> | |
<strip-space elements="*"/> | |
<template match="text()|@*"> | |
<!-- | |
Override default template and swallow all text of all unmatched | |
elements | |
--> | |
</template> | |
<!-- | |
Main document: Generate the table header, then convert each | |
/rss/channel/item into a table row | |
--> | |
<template match="/"> | |
<text>| *ID* | *Summary* | *Priority* | *Component(s)* | *Created* |
</text> | |
<apply-templates select="/rss/channel"/> | |
</template> | |
<!-- One table row per item --> | |
<template match="item"> | |
<value-of select="concat( | |
'| [[', link, '][', key, ']] | ', | |
summary, ' | ', | |
substring-before(priority/text(), ' '), ' | ' | |
)"/> | |
<!-- Component(s) --> | |
<apply-templates/> | |
<value-of select="concat( | |
' | ', substring(created, 6, 11), ' |
' | |
)"/> | |
</template> | |
<!-- First component: Just the text --> | |
<template match="component[1]"> | |
<value-of select="text()"/> | |
</template> | |
<!-- If there are more components separate them by </br> --> | |
<template match="component"> | |
<text> </br> </text> | |
<value-of select="text()"/> | |
</template> | |
</stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment