cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

FOSI Equivalent?

byork
17-Peridot

FOSI Equivalent?

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:variable name="url" select="concat('http://lynms457s/classes/private/getTLMResolution/?pubid=', /OM-Standard-Exmark/PubMeta/@PubID, '&amp;elementid=', @ID,'&amp;t=',generate-id())"></xsl:variable>

<xsl:variable name="TLMLinkend" select='substring-before(document($url)/*/Data,".")'></xsl:variable>

<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"/>-->

<xsl:value-of select="$TLMLinkend"/>

</_ufe:FontRightJust>         

</_sfe:BeforeOrAfterText>

</xsl:if>

</xsl:template>

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

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


View solution in original post

13 REPLIES 13
ClayHelberg
17-Peridot
(To:byork)

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.

byork
17-Peridot
(To:ClayHelberg)

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.

5-3-2016 6-55-32 AM.png

........

5-3-2016 6-48-34 AM.png

<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.

5-5-2016 7-06-06 AM.gif

ClayHelberg
17-Peridot
(To:byork)

Hi Brian--

The command ShowGentext should fix up your filename gentext after updating the links.

--Clay

byork
17-Peridot
(To:ClayHelberg)

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!

ClayHelberg
17-Peridot
(To:byork)

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:

  • full — Updates the generated text in the current document, including tables of contents, indices and cross references. This setting works best with small documents without indices.
  • partial — (default setting) Updates the generated text in the current document, but does not update FOSI Time Independent Variables (TIVs). The most common examples of TIVs are tables of contents, indices and cross references. Other generated text, such as bullets for lists, and numbers for numbered lists or numbered sections, are updated.
  • none — The generated text does not automatically update. Updates to generated text must be manually initiated by choosing ViewGenerated TextUpdate. Large documents work best with this setting.

To display generated text, use the set gentext command. You can set the gentextautoupdate option from several places in the user interface. From ViewGenerated Text, you can choose Full Auto-Updates, Partial Auto-Updates, or No Auto-Updates.

Related topics

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. 

byork
17-Peridot
(To:byork)

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!

Top Tags