<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Nathan,<br>
      <br>
      In order to be sure, I've also tested <font face="courier new,
        monospace">${frameworkDir}</font> in the CSS and I obtained the
      expected result: we don't expand it to the framework directory.
      For your CSS rule at least, it is as if you don't have <font
        face="courier new, monospace">${frameworkDir} </font>at all.
      The system id of the CSS is used as the base URI and I'm guessing
      that the relative path <font face="courier new, monospace">'../../../../../'
      </font>it's actually relevant starting from the location of the
      CSS.<br>
      <br>
      I'm guessing there is nothing in the XML instances that
      differentiates between different versions? Possible solutions:<br>
      <br>
      1. From an Workspace Access [1][2] plugin you can add an
      URIResolver, intercept the CSS resolving [3] and resolve there the
      editor variables:<br>
      <br>
        /**<br>
         * @see
ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension#applicationStarted(ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace)<br>
         */<br>
        @Override<br>
        public void applicationStarted(final StandalonePluginWorkspace
      pluginWorkspaceAccess) {<br>
          <br>
         
      pluginWorkspaceAccess.getXMLUtilAccess().addPriorityURIResolver(new
      URIResolver() {<br>
            @Override<br>
            public Source resolve(String href, String base) throws
      TransformerException {<br>
              System.out.println("href " + href);<br>
              if
      (<a class="moz-txt-link-rfc2396E" href="http://www.oxygenxml.com/extensions/author/css/userCustom.css">"http://www.oxygenxml.com/extensions/author/css/userCustom.css"</a>.equals(href))
      {<br>
                String versionPath =
      pluginWorkspaceAccess.getUtilAccess().expandEditorVariables("${test}",
      null);<br>
                String frameworkURL =
      pluginWorkspaceAccess.getUtilAccess().expandEditorVariables("${framework}",
      null);<br>
                <br>
                String imageURL = frameworkURL + versionPath + "/";<br>
                return new StreamSource(new StringReader(<br>
                    "*[class~=\"topic/image\"][href]{\n" + <br>
                    "    content:oxy_url('" + imageURL + "',
      'attr(href)');\n" + <br>
                    "}"));<br>
              }<br>
              return null;<br>
            }<br>
          });<br>
      <br>
      This goes hand in hand with your idea to tell the user to change a
      custom editor variable in options and then perhaps perform a
      refresh in the editor.<br>
      <br>
      2. This idea is based on a custom form control implementation [4].
      You add this this form control, for example, on the root of the
      document. In this form control the user writes something that
      identifies the version of the document. The form control saves
      this value in a fake attribute using the API :<br>
      <br>
      authorAccess.getDocumentController().setAttribute("myVersion", new
      AttrValue("patch21", "patch21", false), element);<br>
      <br>
      The CSS must contain a rule that uses that attribute, something
      like this:<br>
      <br>
      <div><font face="courier new, monospace"><span class="">*[myVersion]
            *[class~="topic/image"][href]{<br>
                content:oxy_url('${frameworkDir}', '../../../../../',
            oxy_xpath('/topic/@myVersion'),
            'app/main/core/sfdc/htdocs/img/', attr(href));<br>
            }</span></font><br>
      </div>
      <br>
      If you are interested I can send you the source code for the
      built-in text field form control. It would take minimal changes to
      make it behave like above.<br>
      <br>
      <br>
      [1]
<a class="moz-txt-link-freetext" href="http://oxygenxml.com/doc/ug-editor/#concepts/workspace-access-plugin.html">http://oxygenxml.com/doc/ug-editor/#concepts/workspace-access-plugin.html</a><br>
      [2] <a class="moz-txt-link-freetext" href="http://www.oxygenxml.com/oxygen_sdk.html#Developer_Plugins">http://www.oxygenxml.com/oxygen_sdk.html#Developer_Plugins</a><br>
      [3]
      <a class="moz-txt-link-freetext" href="http://oxygenxml.com/doc/ug-editor/#references/handling-css-imports.html">http://oxygenxml.com/doc/ug-editor/#references/handling-css-imports.html</a><br>
      [4]
<a class="moz-txt-link-freetext" href="http://oxygenxml.com/doc/ug-editor/#topics/implementing-custom-form-controls.html">http://oxygenxml.com/doc/ug-editor/#topics/implementing-custom-form-controls.html</a><br>
      <pre class="moz-signature" cols="72">Best regards,
Alex
-- 
Alex Jitianu
<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger
<a class="moz-txt-link-freetext" href="http://www.oxygenxml.com">http://www.oxygenxml.com</a> </pre>
      On 13-May-14 3:32 AM, Nathan wrote:<br>
    </div>
    <blockquote
cite="mid:CAAA7NDgQ6hVd_y_8wgn4XNP2Q2kSRUGD9WE9aML4bNU_bRCP5Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi Alex,
        <div>   Here is the use case scenario I am targeting:</div>
        <div><br>
        </div>
        <div>In the CSS, I have </div>
        <div><span class=""><br>
          </span></div>
        <div><font face="courier new, monospace"><span class="">*</span><span
              class="">[</span><span class="">class</span><span class="">~=</span><span
              class="">"topic/image"</span><span class="">][</span><span
              class="">href</span><span class="">]{</span></font></div>
        <div><font face="courier new, monospace"><span class="">    </span>content:oxy_url('${frameworkDir}',
            '../../../../../', 'app/main/core/sfdc/htdocs/img/',
            attr(href));</font></div>
        <div><font face="courier new, monospace">}</font></div>
        <div><br>
        </div>
        <div>Here, the built-in variable "frameworkDir" works fine. The
          above path is valid when the file is in the "main" branch.</div>
        <div>When the input xml file is in another branch (say
          "/patch/21"), I would like to change the "app/main/core...."
          to "app/patch/21/core...".</div>
        <div>My first idea was to have a custom variable defined (say
          $BRANCH) which would be set to "/main" by default and could be
          reset to "/patch/21" by the user when they change the branch. </div>
        <div><br>
        </div>
        <div>However, while the built-in variable was accepted, the
          custom variable is not accepted here. Also, with respect to
          creating pseudo classes, it would be a maintenance issue since
          I would need to put in every release number (since
          theoretically XML files from any release could be opened) in
          the CSS and also the CSS would need to be updated after every
          release.</div>
        <div><br>
        </div>
        <div>Could you provide some alternatives?</div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div>Nathan</div>
        <div><br>
        </div>
        <div> </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
oXygen-sdk mailing list
<a class="moz-txt-link-abbreviated" href="mailto:oXygen-sdk@oxygenxml.com">oXygen-sdk@oxygenxml.com</a>
<a class="moz-txt-link-freetext" href="http://www.oxygenxml.com/mailman/listinfo/oxygen-sdk">http://www.oxygenxml.com/mailman/listinfo/oxygen-sdk</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>