Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Yes, I know that this is off-topic, but I haven't been able to find info on this anywhere else, so I go to what I consider the most reliable knowledge source I know... PM.

I'm fairly new to XSLT and have a problem.

I have a page that includes the following nodes:

<xsl:template name="deptIndex"> <xsl:variable name="colCount" select="3"/> <xsl:element name="p"> Department Index </xsl:element> <xsl:element name="table"> <xsl:for-each select="pcr_report/info/department[position() mod $c +olCount = 1]"> <xsl:element name="tr"> <xsl:apply-templates select=". | following-sibling::pcr_report +/info/department[position() &lt; $colCount]" mode="deptIndexTD"/> </xsl:element> </xsl:for-each> </xsl:element> </xsl:template> <xsl:template match="department" mode="deptIndexTD"> <xsl:element name="td"> <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="concat('#', .)"/> </xsl:attribute> <xsl:value-of select="."/> </xsl:element> </xsl:element> </xsl:template>
These nodes display an index of departments at the top of a larger page.

Currently they display simply as a very long vertical list.

I need them to display in 5 columns like this:

Dept1 Dept5 Dept9 Dept13 Dept17 Dept2 Dept6 Dept10 Dept14 Dept18 Dept3 Dept7 Dept11 Dept15 Dept19 Dept4 Dept8 Dept12 Dept16 Dept20
I've googled 'till I just can't google no more, and I've come up wish zilch.

Anyone know how to do this?


In reply to OT - Dynamic data into columns in XSLT by rashley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-18 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found