Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

XSL Crossref between 2 documents / srcfile and ID

Explorer ,
Mar 02, 2016 Mar 02, 2016

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
920
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Mar 02, 2016 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

Translate
Contributor ,
Mar 02, 2016 Mar 02, 2016

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

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

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

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

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

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