[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

String concatenation inside open tag

Subject: String concatenation inside open tag
From: Jason Solan <jsolan@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 27 Feb 2007 09:14:43 -0500
 String concatenation inside open tag
Hello all,
I'm new to XSL.

I have 2 XML documents I'm using. One I loop through and basically
create an html document with the data.
The other gives rules to the data, which I get using the document()
function.

Doc1:

<document>
  <row>
    <columnA>Foo</columnA>
    <columnB>Bar</columnB>
    ...
  </row>
  ...
</document>


Doc2:
<document>
  <column>
    <name>columnB</name>
    <rule>
      <javascript>
        <function_name>myFunction</function_name>
        <parameters>
          <param>Hello</param>
          <param>
            <column>columnA</column>
          </param>
          <param>World</param>
          ...
        </parameters>
      </javascript>
    </rule>
  </column>
  ...
</document>

------

When I'm parsing doc1 and I come across columnB, I see that there should
be a javascript function instead of just outputting the data normally.
What I need as output is:

<a href="javascript:void(0)"
onclick="javascript:myFunction('Hello','Foo','World')">Bar</a>


How my initial thought to handle it is:
If there is a javascript function for this column I would output:
<a href="javascript:void(0)"

I would then add the onclick event for the function name:
onclick="javascript:myFunction(

I think I can handle that part.

The problem comes in because I don't know how to parse the parameters.
I'm in an open "<a" tag so I can't do (unless I'm mistaken) an
xsl:for-each (which is how I would normally handle this situation).
There can be an arbitrary number of parameters for any given function.
Even if I can do a for-each, I would think with all the great stuff in
XSLT there is an easier way that I'm missing.

To throw in an extra wrinkle, if the parameter has a child element named
"column", then use the value of that column name in doc1 for the current
row.

I'm using the PHP xslt processor, which I'm pretty sure is version 1.0.

I'm sorry if this type of question has been answered before, I tried
searching, but didn't know what to search for to get a hit.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.