Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Here is my custom XSL-FO and I am wondering how I can convert this for display in editor with FOSI
I really just want to pull the TLMLinkend from the web-call and return it to the editor display. The two bold variables are my web-path and result and I display the value in the PDF with xsl:value-of select.
<!--Gentext template for Context: Graphic-->
<xsl:template match="Graphic" mode="expand-gentext" priority="0">
<xsl:copy>
<xsl:attribute name="_gte:Gentext-Expanded">y</xsl:attribute>
<xsl:apply-templates mode="expand-gentext" select="@*"></xsl:apply-templates>
<xsl:if test="not(@_gte:id)"
<xsl:attribute name="_gte:id">
<xsl:value-of select="'_g_'"/>
<xsl:value-of select="generate-id(.)"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="expand-gentext" select="* | text() | processing-instruction()"> </xsl:apply-templates>
</xsl:copy>
<!--Unconditional AddAfter-->
<xsl:if test="not(@_gte:Gentext-Expanded)">
<_gte:Must-Expand-Gentext></_gte:Must-Expand-Gentext>
<_sfe:BeforeOrAfterText>
<_ufe:FontRightJust>
<!--<xsl:value-of select="@Fileref"/>-->
</_ufe:FontRightJust>
</_sfe:BeforeOrAfterText>
</xsl:if>
</xsl:template>
Thanks in advance!
Solved! Go to Solution.
If I understand correctly what you want to do, then as Clay indicated you can use SYSTEM-FUNC to call a previously sourced ACL function that returns the value to a usetext source for output:
ACL
===
function TLMLinkend(window,oid)
{
x=...
return x
}
FOSI
====
<e-i-c gi="graphic">
<charlist>...</charlist>
<att>
<fillval attloc="SYSTEM-FUNC" attval="TLMLinkend" fillcat="usetext" fillchar="source">
<charsubset>
<usetext>...</usetext>
</charsubset>
</att>
...
Good luck!
Suzanne
Hi Brian--
A real FOSI expert might have a better answer for this, but if it were my job I would probably tackle it via an ACL function. I would write an ACL function to scan the target document and extract the string I want, and then use the SYSTEM-FUNC feature to invoke it in the FOSI stylesheet. For more information, see the topic "Passing values to attribute rules using variables and functions" in the Help Center. (The section "Using the return value of a function as an attribute value in a use value (fillval)" is probably closest to your use case.)
--Clay
+1 to Clay's answer. What you're asking is if FOSI can return and process a result from a web services request, and I think the best way is to call out to an ACL function to do achieve that. I would note that ACL can itself call into other languages such as Java if required.
Clay and Gareth,
I saw that in my digging. I will have to give that a try to see how far I can get.
Thanks,
Brian
Hi Brian,
What is the markup in the XML document?
Suzanne Napoleon
www.FOSIexpert.com
"WYSIWYG is last-century technology!"
Suzanne,
It looks something like this in most cases.
........
<PubMeta Brand="Exmark" CE="No" ClientPubNo="" CopyrightYear="2016"
FormNumber="4502-880" Lang="EN" LangParentForm="" LangParentID=""
LangParentRev="" PageSize="Letter" PhoneNoCan="" PhoneNoMex=""
PhoneNoUS="" ProductFamily="Topdressers" PubID="101772"
PublicationType="Installation Instructions"
RegistrationURL="www.Exmark.com" Rev="A" ServiceURL="www.Exmark.com">
<?TranslationData DueDate="05/31/2016" Author="Brian York" ?>
</PubMeta>
.......
<Figure ID="ID000-090-608">
<Graphic Fileref="g000502.eps" ID="ID000-090-612"/>
<FigTitle></FigTitle>
<FigSubTitle>Safety Alert Symbol</FigSubTitle>
</Figure>
We are using a database to govern the artwork that is used/displayed. It is tracked by the main book pubID and then the graphic ID.
So with this we can swap the graphic without needing to checkout the object the graphic is contained in. I am able to show the correct number in the PDF but would like to show the correct number in the editor window.
Brian
If I understand correctly what you want to do, then as Clay indicated you can use SYSTEM-FUNC to call a previously sourced ACL function that returns the value to a usetext source for output:
ACL
===
function TLMLinkend(window,oid)
{
x=...
return x
}
FOSI
====
<e-i-c gi="graphic">
<charlist>...</charlist>
<att>
<fillval attloc="SYSTEM-FUNC" attval="TLMLinkend" fillcat="usetext" fillchar="source">
<charsubset>
<usetext>...</usetext>
</charsubset>
</att>
...
Good luck!
Suzanne
Okay so I got that part working!. Many thanks to you all!
So here is my next issue. When I make a change to the my graphic in this case the FOSI doesn't refresh until I get out and come back into the book. I'm sure there is a refresh command I just don't know what it is. I just would fire that on the acl that I use to change the graphic number.
This is just an example but the graphic changes without changing the file ref. So if I close and reopen the document it does display the correct number.
Hi Brian--
The command ShowGentext should fix up your filename gentext after updating the links.
--Clay
Thanks Clay!
So now I have another question. Is there a way to only update a certain objects gentext? If I turn on and off gentext or update it does the whole doc. Takes much longer than I would like.
This is what I was doing to update the gentext.
local previous_gentext_state = option('gentextautoupdate');
set gentextautoupdate=none;
set gentextautoupdate=$previous_gentext_state;
Thansk!
Hi Brian--
Sorry, but no, I don't know of a way to update the gentext for just one piece of content. I had a use case for that a few years back, and spent some time investigating, but never found a solution for it unfortunately.
If you do find a way to do this, please report back to the group how you did it. It would be a very useful little piece of knowledge to file away.
--Clay
Maybe set gentextautoupdate=partial would work for you. From the Help info:
This command determines how the generated text in the Edit window updates. It can be changed when generated text is not visible, but the change won’t affect program performance until you display the generated text (for example, by setting gentext to on).
The available settings are:
To display generated text, use the set gentext command. You can set the gentextautoupdate option from several places in the user interface. From View→Generated Text, you can choose Full Auto-Updates, Partial Auto-Updates, or No Auto-Updates.
One thing I am noticing is that as I scroll through document when I come to a graphic I cycle through the graphic command two to three times. Seems real strange. Has anyone came across that. I would like to somehow eliminate the extra calls to my function. I am not sure what segregate the requests though.
I was able to minimize the performance issue by adding a specval. No way to just isolate an area for gentext update.
<specval attname="gentext-only" attloc="system-var" attval="#ANY"/>
So it ends up like this:
<att>
<specval attname="gentext-only" attloc="system-var" attval="#ANY"/>
<fillval attname="TLMLinkend" attloc="SYSTEM-FUNC" fillcat="usetext" fillchar="source"/>
<charsubset>
<usetext placemnt="after"></usetext>
</charsubset>
</att>
Thanks to everyone for their help on this!