Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 144949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:20:12+00:00 2026-05-11T08:20:12+00:00

At work I’ve been given the fun task of generating PDFs with XSL. The

  • 0

At work I’ve been given the fun task of generating PDFs with XSL. The XML structure I’m working with is similar to

<records>     <topLevel>         <topLevelID></topLevelID>         <secondLevel>             <secondLevelID></secondLevelID>             <thirdLevel>             </thirdLevel>             <thirdLevel>             </thirdLevel>         </secondLevel>     </topLevel>     <topLevel>         <topLevelID></topLevelID>         <secondLevel>             <secondLevelID></secondLevelID>             <thirdLevel>             </thirdLevel>             <thirdLevel>             </thirdLevel>         </secondLevel>     </topLevel> </records> 

I would try to give a more meaningful example of the XML, but I don’t feel like approaching any legal boundaries that may exist. With that XML structure, I have to output a block of text in the PDF for every thirdLevel node. The XSL I have so far is like

<xsl:for-each select ='topLevel'>               <xsl:variable name='topID' select='topLevelID'/>     <xsl:for-each select ='secondLevel'>         <xsl:variable name='secondID' select='secondLevelID'/>         <xsl:for-each select='thirdLevel'>                         <fo:block-container position='absolute' height='12.8pt' width='220.8pt' left='160pt' display-align='auto'>                 <xsl:attribute name='top'>                     <xsl:value-of select='concat(193 + [whatshouldgohere]), 'pt')'/>                 </xsl:attribute>                 <fo:block font-size='7pt'>                                               <xsl:call-template name='insertThirdLevel'/>                 </fo:block>             </fo:block-container>         </xsl:for-each>     </xsl:for-each> </xsl:for-each> 

Basically, I need to add some value to the top attribute to make the text for each thirdLevel node appear on its own line. I’ve tried using combinations of adding/multiplying by the ID (starts at 1 and increases by 1 for each set) and position(), but I can’t seem to get it right.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:20:13+00:00Added an answer on May 11, 2026 at 8:20 am

    I think you should really look into <xsl:apply-templates>, it can save you a lot of typing.

    Simplified version:

    <xsl:variable name='line-height' select='10' />  <xsl:template match='/records'>   <xsl:apply-templates select='//thirdLevel' /> </xsl:template>  <xsl:template match='thirdLevel'>   <xsl:variable name='top' select='193 + position() * $line-height' />   <fo:block-container top='{concat($top , 'pt')}'>     <fo:block font-size='7pt'>                                 <xsl:call-template name='insertThirdLevel'/>     </fo:block>   </fo:block-container> </xsl:template>  <xsl:template name='insertThirdLevel'>   Third Level! </xsl:template> 

    Simplified output (‘fo’ namespace excluded):

    <fo:block-container top='203pt'>   <fo:block font-size='7pt'>     Third Level!   </fo:block> </fo:block-container> <fo:block-container top='213pt'>   <fo:block font-size='7pt'>     Third Level!   </fo:block> </fo:block-container> <fo:block-container top='223pt'>   <fo:block font-size='7pt'>     Third Level!   </fo:block> </fo:block-container> <fo:block-container top='233pt'>   <fo:block font-size='7pt'>     Third Level!   </fo:block> </fo:block-container> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Work on a support helpdesk. New tickets come in and records are created in
Work on C#.In my application several time need to select\collect datafrom DB.Fro this task
TFS2010- Work item Search Popup control is not working ,no error message is showing
I work on a large Java based web application, it has been built up
At work we are being asked to create XML files to pass data to
I work in EF.Xml definition table is ... <EntityType Name=ShippingCards> <Key> <PropertyRef Name=ShippingCardID />
At work I have been tasked with adding additional functionality to an existing MVC
work on sql-server-2005 SELECT A.specific_customization_id , A.customization_id , A.customization_value , A.customization_price , A.customization_cost ,
work on asp.net vs 05 C#.Master page header contain the bellow code <script type=text/javascript
work on SQL Server 2000. want to Automated Email Notifications using SQL Server Job

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.