Skip to main content
17-Peridot
May 2, 2016
Solved

FOSI Equivalent?

  • May 2, 2016
  • 2 replies
  • 4643 views

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!

Best answer by SuzanneNapoleon

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


2 replies

18-Opal
May 2, 2016

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

16-Pearl
May 3, 2016

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

12-Amethyst
May 2, 2016

Hi Brian,

What is the markup in the XML document?

Suzanne Napoleon

www.FOSIexpert.com

"WYSIWYG is last-century technology!"

byork17-PeridotAuthor
17-Peridot
May 3, 2016

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

12-Amethyst
May 3, 2016

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