You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Mattias Bogeblad <ma...@got.sema.se> on 2000/05/15 14:38:12 UTC

Sort-problem.

Hi! 

I have a problem using the xsl:sort-fuction in xalan. 
We use Xalan on several machines(NT, Solaris, HP) and the result is different.
The code goes like this.

<select name="{xml/row/input_box1_name}">
     <xsl:for-each select="xml/row/offices">
      <xsl:sort select="office_name" order="ascending"/>
      <option value="{office_number}">
       <xsl:value-of select="office_name"/>
      </option>
     </xsl:for-each>
</select>

In NT(Swedish) it sorts the swedish characters correct but on Solaris and HP the order is incorrect.
We have tried to locate any settings in solaris that fixes this but have failed. Could there
be another explaination or should we use sort in another way?
If anyone has some similar experiences suggestions would be welcome.

Best Regards
Mattias Bogeblad

------------------------------------------------------------------------------------
Mattias Bogeblad - Web-developer Sema Group Sweden
Phone:          +46 31-7514769
Cell:               +46 708-514769
E-Mail:           mattias.bogeblad@got.sema.se
Homepage:   http://w3.informatik.gu.se/~s94nazgu/

"When all else fails, read the manual"
------------------------------------------------------------------------------------

writing html tags from Java extension

Posted by August Gresens <au...@blackhammer.com>.
I want to write an extension that automates the creation of <option> 
tags for our stlyesheets. We have instances (a date drop down box for 
example) were we have to write out dozens of these tags, and the xsl 
method of doing this is really too verbose (see below under code).

Currently I'm trying to do this by creating an extension function in 
Java that generates a bunch of these tags as needed and returns a 
string. As in:

	public static String getOption()
	{
		String out = new String("<option>")
		return out;
	{

Ends up printing something like this to the html:

"&lt;option&gt;


I also tried this:

	public static String getOption()
	{
		String out = new String("<![CDATA[<option>]]>")
		return out;
	{

Which appeared as this in the browser:

&lt![CDATA[<option>]]&gt;

Is there any way to get around this problem returning strings, or 
must I do something more fancy, like create an extension element that 
will return a NodeList to the xslt, and then operate on the new nodes?

Or - perhaps -- I can call a template within xslt from Java, passing 
it the parameters on the fly?

thanks,

a


--> code to write an option tag --->


Here's the template to write an option tag using

<xsl:template name="option_tag">
         <xsl:param name="value">no_value</xsl:param>
         <xsl:param name="cur_val">no_curvalue</xsl:param>
         <xsl:param name="text">no_text_defined</xsl:param>

         <xsl:element name="option">
                 <xsl:attribute name="value"><xsl:value-of 
select="$value"/></xsl
:attribute>
                 <xsl:if test="$value = $cur_val">
                         <xsl:attribute name="selected">true</xsl:attribute>
                 </xsl:if>
                 <xsl:value-of select="$text"/>
         </xsl:element>
</xsl:template>


To write each option tag, however, the following must appear. 31 of 
these listed down the page cannot be the only way to do this!

<xsl:variable name="currentValue" 
select="account/trip[$trip]/contact/location"/>

<xsl:call-template name="option_tag">
<xsl:with-param name="value">Home</xsl:with-param> 
<xsl:with-param name="cur_val"><xsl:apply-templates 
select="$currentValue"/></xsl:with-param>
<xsl:with-param name="text">Home</xsl:with-param>
</xsl:call-template>
-- 
/////////////////////////
August Gresens
Black Hammer Productions
august@blackhammer.com
212 625-8980 ext 21
/////////////////////////