473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Need to manipulate X and Y positions (and page break) via XSLT

Hi

Bit of a tricky question (I think). I am trying to print stickers/labels using a process by which I am converting XML to HTML (using XSLT) then convert to .PDF then print. The stickers themselves are all 1X1 and 64 can fit on the page (8 rows with 8 columns). Each set of stickers will have a header sticker with slightly different info. I have formatted the XML input to have a header node and a collection of child nodes associated which are the stickers themselves.

Conceptually I would like to build a table in html and for each header or sticker build a 1X1 inside a <td>. The trick will be to track 1 through 8 across (then need a new <tr> and also track the vertical (need a page break). There is no limit to how many stickers there can be. Since XSLT variable declarations are essentialy immutable and don't behave like counters, how do I track the X,Y positions and build this out in an XSLT without having to create 64 tables, etc... I was looking at calling a C# method but this seems to be a last resort.

Thanks
Feb 24 '10 #1
3 2028
drhowarddrfine
7,435 Expert 4TB
There are counters in xslt and you can do math but don't ask me any more about it cause I've never used it.
Feb 24 '10 #2
I was reading about position() as it relates to relate position in the XML doc. I could in theory even use the mod function to break on 8th row but I don't know how I would track my vertical position on the page.

Thanks.
Feb 24 '10 #3
jkmyoung
2,057 Expert 2GB
Are you using xsl-fo?

Can think of several ways, depending on your xml layout, eg roughly:

Expand|Select|Wrap|Line Numbers
  1. apply-templates select="sticker[position() mod 8 = 1]" mode="row"
  2.  
  3.  
  4. <template match="sticker" mode="row">
  5.   <tr>
  6.     <xsl:apply-template select=".|following-sibling:sticker[position() &lt; 8]"/>
  7.   </tr>
  8.   <xsl:if test="position() mod 64 = 1"> <!-- can't remember if you need 8 or 64 here; try it out. --> 
  9.   break
  10.   </xsl:if>
  11. </template>
  12.  
  13. <template match="sticker">
  14.    <td> 
  15.     some output here..
  16.    </td>
  17. </template>
  18.  
Feb 24 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Romeo Disca | last post by:
Hello, i just want to make an identity transformation of an xhml document and i don't want entities to be resolved. &nbsp; should result in &nbsp; and not ' '. Is there any chance to...
7
by: Mike Kamermans | last post by:
I hope someone can help me, because what I'm going through at the moment trying to edit XML documents is enough to make me want to never edit XML again. I'm looking for an XML editor that has a...
47
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
0
by: Christopher M. Lauer | last post by:
I have done my best to answer this question but can not find the proper set of commands. I would like to transform an xml file (in code behind) and display its output in a specific html tag,...
2
by: darrel | last post by:
I eventually want to pass a variable to my XSLT file, but, for now, I'm just trying to be able to declare it globally in the XSLT file itself. So, I added this to the top of the page: ...
7
by: Roshawn Dawson | last post by:
Hi, I have an xslt file located in the root directory. It is used by an aspx pages in both the root directory and a subdirectory. But for some strange reason, the aspx page in the subdirectory...
3
by: awebguynow | last post by:
with an xpath expr: step1/step2 I'm trying to get the position() of step2, using the qualifying predicate. I've seen some suggestions, of ways to do this, using count() instead, but I'm not...
0
by: vinki | last post by:
Hi Everyone, I have this xslt file. I want to print the page directly to the printer after every MOP template is matched. So for example the ouput is coming to the HTML page like this ...
4
by: J | last post by:
I've spent most of the day on this, and I just can't seem to find a solution, please help me! :) I'm recieving XML that I can't modify that looks like: <?xml version="1.0"?> <Doc> <Page>...
2
by: M | last post by:
Could anyone please help me out? I am working on a new Intranethomepage for our company, and I really, really would like to make something similar to http://www.google.nl/ig? hl=nl . There you...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.