Discussion


Just a note to recommend that anyone trying this should review wwp-users archives (thread starting at message 34160). There's some good discussion leading up to and after this page was created, should help with getting it working.


FYI, I tried to use it and seemed to get close but couldn't quite get it to work. I basically set it up as the wiki describes, also adding a wwpage:replacement call in pages.xsl. I'm using 2009.3, so the project.cache is in C:\Documents and Settings\Me\Local Settings\Temp\Webworks\ePublisher\randomString\Data rather than in the project dir. Anyway the code seemed to find the project.cache, and seemed to complain appropriately when an incorrect variable name was specified. When a variable that did exist was specified, output was entirely blank. Tried moving the call in pages.xsl around but that seemed to cause more errors.


Whenever working with XSLT, wwlog:Error() is your friend. I use them liberally to verify I have what I expect when I need it.

  <xsl:variable name="VarLogNote1" select="wwlog:Error('ProductVersion variable is: ', $GlobalProductVersion )" />

To use a variable with a replacement, be sure to put it in braces, like this:

  <wwpage:Replacement name="product-version" value="{$GlobalProductVersion}" />

Then in your ASP, have a call like this:

  <span wwpage:content="product-version">1.0</span>


OK, I got it to work, thanks to Mike H for his offline email help. The missing piece for me was that I didn't have the XSLT code in the right place in pages.xsl. It should go in the "<!-- Replacements -->" block, after

     <xsl:variable name="VarReplacementsAsXML">

And outputting variable values to the error log as above was helpful too. So, it does work.


Final note. Mike will probably clarify this on the main page, but it's important to realize that this code only gets the first instance of the specified FrameMaker variable ePublisher finds. So in other words, it uses this variable "project wide". If you have several FrameMaker documents that define different values for the variable, they will not get picked up, only the first project-wide one.

That plus the fact it can't be used in automated builds (Automap) easily (project.cache not prebuilt) does limit the overall usefulness of this solution.

DevCenter/Projects/FM Variables with XSLT/Discussion (last edited 2010-09-14 15:34:12 by BenAllums)