Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Steve 472 posts 1216 karma points
    Jan 20, 2015 @ 22:10
    Steve
    0

    XSLT Xpath Question

    I am trying to write some XSLT to format the xml results in my forms that are emailed to include fieldsets in the table of data sent. I don't know if I am doing the Xpath test in the "if" correctly. Here is what I have:

    <xsl:if test="preceding-sibling::*./@fieldsetindex != ./@fieldsetindex">
    
                                      <td valign="top" style="border:1px solid black;padding:5px;font-family:Verdana,Helvetica,Arial,sans-serif;font-size:11px;background-color:#ccc;">
                                       </td>     
                                 </xsl:if>
    
                                        <td valign="top" style="border:1px solid black;padding:5px;font-family:Verdana,Helvetica,Arial,sans-serif;font-size:11px;">
                                              <strong>
                                                    <xsl:value-of select="./caption" disable-output-escaping="yes"/>
                                              </strong>
                                        </td>
  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Jan 20, 2015 @ 22:15
    Chriztian Steinmeier
    0

    Hi Steve,

    In this instance you need to use the current() function:

    <xsl:if test="not(preceding-sibling::*[@fieldsetindex = current()/@fieldsetindex])">
       ...
    </xsl:if>
    

    (If I understand what you're trying to do :-)

    /Chriztian

  • Steve 472 posts 1216 karma points
    Jan 20, 2015 @ 22:18
    Steve
    0

    Sorry, I forgot to mention that aparently there is no way to retreve the actual fieldset text, so I am just created a blank "<td>" to separate the various fieldsets.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Jan 20, 2015 @ 22:32
    Chriztian Steinmeier
    0

    I just created a Gist with a file I've created for this purpose - maybe you can use that as inspiration:

    It doesn't cover all the field types but at least it's a head start...

    /Chriztian

  • Steve 472 posts 1216 karma points
    Jan 20, 2015 @ 22:34
    Steve
    0

    Thanks!

  • Steve 472 posts 1216 karma points
    Jan 20, 2015 @ 22:43
    Steve
    0

    Well, I ended up getting it to make an empty "<td>" where the form fields were by looking for the attribute of fieldsetindex, since there was no value for fieldset. Which is crazy, just saying.

Please Sign in or register to post replies

Write your reply to:

Draft