[xsl] Pulling Information from One Section to Another

Subject: [xsl] Pulling Information from One Section to Another
From: Horace Burke <xmlmarkup@xxxxxxxxx>
Date: Sat, 12 Feb 2011 09:40:07 -0800 (PST)
Hi all,

I am working on a project creating XSL-FO stylesheet and come across
an issue 
that I would like your help resolving. I am using Arbortext Epic
Editor / E3 
Engine for rendering.

Here is the dilemma:

In the XML snippet
below, I want to pull information from section 16 (labeled 
(2) in snippet) to
section 15 (labeled (1) in snippet) for output display in the 
PDF. In other
words, this particular information (2) in section 16 should only 
display in
section 15 (1) if both sections are in the same level ("<sds>") or 
same
hierarchical parent. The <sds> element/tag is nested within anchor element
<gblsds> (<!ELEMENT gblsds (title, ((cvrSheet, sds, sds+) | sds))>).

The
problem is that I am using "//" to pull the information and it is searching
the entire XML and placing the data in the section 15 (labeled (3) in snippet)
that doesn't required it.

How can I get the information from section 16 to
display only in the section 15 
of the same hierarchy?

Please see XSL and XML
snippets below and let me know if additional information 
is needed.

Thanks
in advance for your help. I really appreciate it.

Regards,
H. Burke 

====XSL
SNIPPET====
<!--+=== Section 15 ===+-->
<xsl:template match="RegInfo">
  ...
 
<!--THE ELEMENT/TAG IS IN SECTION 16, HOWEVER, THE INFORMATION IS REQUIRED IN
SECTION 15-->
  <xsl:if test="//OtherInfo/chemSafAsmnt">
    <fo:table-row>
      <fo:table-cell padding-top="1.2mm" padding-bottom="1.2mm"
text-align="left" number-columns-spanned="2">
        <fo:block
start-indent=".3em" font-weight="bold" end-indent="2mm">
  
<xsl:apply-templates select="//OtherInfo/chemSafAsmnt/title"/>
       
</fo:block>
      </fo:table-cell>
      <fo:table-cell padding-top="1.2mm"
padding-bottom="1.2mm" 
text-align="left" number-columns-spanned="5">
       
<fo:block start-indent=".3em" end-indent="2mm">
   <xsl:apply-templates
select="//OtherInfo/chemSafAsmnt/para"/>
        </fo:block>
     
</fo:table-cell>
    </fo:table-row>
  </xsl:if>
</xsl:template>

====XML
SNIPPET====
<gblsds>
  <title>SDS Information Sheet</title>
  ...
  <sds
langID="EN">
    ...
    <RegInfo><title>Section 15</title>
     
<CaReg><title>Canada</title>
        <para>This product is exempt from WHMIS
label and SDS 
requirements.</para>
        ...
      </CaReg>
<!--(1)INFORMATION PULLED FROM SECTION 16 WILL DISPLAY HERE IN THE PDF-->
      <para>Some ingredients listed in Section 15 are...in Section 3.</para>
    </RegInfo>
    <OtherInfo><title>Section 16</title>
     
<SafRating><title>Safety Rating</title>
        ...
      </SafRating>
     
...
<!--(2)PULLING THIS INFORMATION (<chemSafAsmnt>...</chemSafAsmnt>) FROM
SECTION 
16 TO SECTION 15-->
      <chemSafAsmnt><title>SAC
Requirements</title>
        <para change="yes">Test SAC requirements
1/31/11</para>
      </chemSafAsmnt>
    </OtherInfo>
    <disclaimer>WHILE
INC. BELIEVES THE INFORMATION...SUBJECT TO LOCAL LAWS OR
REGULATIONS.</disclaimer>
  </sds>
  <sds langID="EN">
    ...
   
<RegInfo><title>Section 15</title>
      <CaReg><title>Canada</title>
       
<para>This product is exempt from WHMIS label and SDS 
requirements.</para>
        ...
      </CaReg>
<!--(3)INFORMATION IS NOT IN SECTION 16 BELOW AND
SHOULD NOT DISPLAY IN THE 
PDF-->
      <para>Some ingredients listed in
Section 15 are...in Section 3.</para>
    </RegInfo>
   
<OtherInfo><title>Section 16</title>
      <SafRating><title>Safety
Rating</title>
        ...
      </SafRating>
      ...
<!--(4)THE INFORMATION
(<chemSafAsmnt>...</chemSafAsmnt>) IS NOT IN THIS SECTION 
16 AND SHOULD NOT
DISPLAY IN SECTION 15 OUTPUT-->
      <para>This SDS complies with EC
Regulations.</para>
    </OtherInfo>
    <disclaimer>WHILE INC. BELIEVES THE
INFORMATION...SUBJECT TO LOCAL LAWS OR 
REGULATIONS.</disclaimer>
  </sds>  
 
</gblsds>
_____________________________________________________________________________
_______
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from
Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091

Current Thread