XSL Crossref between 2 documents / srcfile and ID

Explorer ,
Mar 02, 2016

Copy link to clipboard

Copied

Hello everybody

I am newbie in framemaker 15.

I'm lost....  and I need your help.

I have a problem to make a link between 2 document with xsl

I have an Xref element, for the external cross-references, where

DTD

<!ELEMENT Xref EMPTY>

<!ATTLIST Xref

  Format CDATA #IMPLIED

  srcfile CDATA #IMPLIED

>

RW

element "Xref "

  {

  is fm cross-reference element;

  attribute "Format" is fm property cross-reference format;

  }

in my document B.xml where is the Xref :

<Xref Format = "X_Text" srcfile = "A.xml#CHDJCICFE0"/>

in my document A.xml, where is the target:

<Abv ID = "CHDJCICFE0">Toto</Abv>

How i do in XSL, to select the content of the element Abv ---> Toto

How make with one attribute which has an "ID", and the other attribute which has a "srcfile"?

<xsl:template match="Xref">

      <A HREF="{@srcfile}" style="text-decoration:none;text-align:left;color:blue">

          <xsl:choose>

               <xsl:when test="@Format='X_Text'">

                     <xsl:value-of select="????????????????"/>

               </xsl:when>

          </xsl:choose>

     </A>

</xsl:template>

In advance, thank you very much

Jean Claude

TOPICS
Structured

Views

524

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Explorer , Mar 02, 2016
JCmayer Explorer , Mar 02, 2016
Yes, i have the response....With the variable document, I must do  <xsl:value-of select="document($document,/)//*[@ID=$refid]/text()"/>Thank you very much again Martti for your help.Jean Claude

Likes

Translate

Translate
Jump to answer Jump to answer
Contributor ,
Mar 02, 2016

Copy link to clipboard

Copied

Assuming that documents A.xml and B.xml are in the same folder, something like this should work:

...

<xsl:when test="@Format='X_Text'">

  <xsl:variable name="document" select="substring-before(@srcfile,'#')"/>

  <xsl:variable name="refid" select="substring-after(@srcfile,'#')"/>

  <xsl:value-of select="document($document)//*[@ID=$refid]/text()"/>

...

BR, Martti

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
JCmayer AUTHOR
Explorer ,
Mar 02, 2016

Copy link to clipboard

Copied

Thank you very much Martti for your help.

Yes the documents are in the same folder.

But i have problem always.

I tested the variales name "document" and "refid" like this

<xsl:value-of select="$document"/>      OK it's good, result file "A.xml"

<xsl:value-of select="$refid"/>              OK it's good, result ID "CHDJCICFE0"

When I put "document($document) .............", nothing !

I tested alsoI "document('$document') .............", nothing !

Jean Claude

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Mar 02, 2016

Copy link to clipboard

Copied

Yes, i have the response....

With the variable document, I must do

  <xsl:value-of select="document($document,/)//*[@ID=$refid]/text()"/>

Thank you very much again Martti for your help.


Jean Claude

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more