resource files and plugin

In my search request view plugin I have a velocity template that has a reference to an xslt file i wrote, I'd like my plugin to install this xslt file automatically (ideally in "http://myserver:2990/jira/styles/)

I've tried adding a resource in atlassian-pugin.xml but I can't figure out which url to use to reference the xslt file.

2 answers

1 accepted

This widget could not be displayed.

atlassian-plugin.xml:

<web-resource key="xslt-resources" name="Xslt Web Resources">
    <resource type="download" name="test.xslt" location="/xslt/test.xslt"/>
  </web-resource>

vm file:

<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet href="$webResourceManager.getStaticPluginResource("com.myplugin:xslt-resources","test.xslt")" type="text/xsl"?>

...

This widget could not be displayed.

You can take a look at

https://developer.atlassian.com/display/PLUGINFRAMEWORK/Web+Resource+Plugin+Module

https://developer.atlassian.com/display/PLUGINFRAMEWORK/Web+Resource+Plugin+Module#WebResourcePluginModule-Non-BatchedMode

You can add param <param name="batch"value="false"/> and then refer to the resource using the url pattern given in the documentation:

SERVER_ROOT/s/BUILD_NUM/PLUGIN_VERSION/SYSTEM_COUNTER/_/download/resources/PLUGIN_KEY:MODULE_KEY/RESOURCE_NAME

Can I use the resource from the velocity template this way?

Yes, you can. I can provide you with some sample code for atlassian-plugin.xml and the vm file if you give me an example of what you want to achieve exactly.

Here is my velocity template (A modified version of the standard view issues xml) , I would like to have my xslt file instead of MYSTYLESHEET,

<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet href="MYSTYLESHEET" type="text/xsl"?>

<rss version="0.92">

<channel>

<title>#xmlEscape($title)</title>

## Ensure we have no spaces around the link tag and its value. JRA-16175

<link>#xmlEscape($link)</link>

<description>#xmlEscape($!{description})</description>

#if ($rssLocale)

<language>$rssLocale</language>

#end

#if ($totalissue)

<issue start="$!{startissue}" end="$!{endissue}" total="$!{totalissue}"/>

#end

<build-info>

<version>#xmlEscape($version)</version>

<build-number>#xmlEscape($buildNumber)</build-number>

<build-date>#xmlEscape($buildDate)</build-date>

</build-info>

this is the configuration in atlassian-plugin.xml

<web-resource name="xslt" i18n-name-key="xslt.name" key="xslt">

<description key="xslt.description">.xslt resources for search request plugins</description>

<resource name="GroupByCategoriesEdt" type="download" location="xslt/GroupByCategoriesEdt.xslt">

<param name="batch" value="false"/>

</resource>

<resource name="GroupByDeveloppeur" type="download" location="xslt/GroupByDeveloppeur.xslt">

<param name="batch" value="false"/>

</resource>

</web-resource>

I tried with <?xml-stylesheet href="$webResourceManager.requireResource("xslt:GroupByDeveloppeur")" type="text/xsl"?> but It doesent seem to work, in the console it tells me "Cannot find we resource module for: xslt:GroupeByDeveloppeur"

Thanks for your help

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

506 views 3 18
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you