Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 31st, 2007, 08:23 AM
Registered User
 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem in Creating Select box

Hi,

I am new to XSL as well as to this forum. This is my first post. I have a code to transform RDF data to HTML. The problem is that in my code I wants to create 2 select boxes but it creates only one. Below is the code chunk. can you please tell me where am I wrong ?

<xsl:when test="rdf:Description/si:outlink">
<form id="p" name="f1" action="search" onsubmit="showlinkdetails()">
    <input type="hidden" name="query">
    <xsl:attribute name="value">
        <xsl:value-of select="rdf:Description/si:query" />
    </xsl:attribute>
    </input>
    <select name="out">
    <xsl:for-each select="rdf:Description/si:outlink">
        <option>
            <xsl:value-of select="@rdf:resource" />
        </option>
    </xsl:for-each>
    </select>
<xsl:if test="rdf:Description/si:inlink">
    <select name="in">
    <xsl:for-each select="rdf:Description/si:inlink">
        <option>
              <xsl:value-of select="@rdf:resource" />
          </option>
  </xsl:for-each>
  </select>
</xsl:if>
<input type="submit" value="Refine Search" />
</form>
</xsl:when>

Thanks a lot.

 
Old January 31st, 2007, 08:33 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Can't see anything obviously wrong, but you haven't shown your input. It's also useful to show desired output and actual output.

One little tip, the construct:

<input type="hidden" name="query">
    <xsl:attribute name="value">
        <xsl:value-of select="rdf:Description/si:query" />
    </xsl:attribute>
    </input>

can be simplified to

<input type="hidden" name="query"
      value="{rdf:Description/si:query}" />

It's called an attribute value template.



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 31st, 2007, 08:47 AM
Registered User
 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mhkay
 Can't see anything obviously wrong, but you haven't shown your input. It's also useful to show desired output and actual output.

One little tip, the construct:

<input type="hidden" name="query">
    <xsl:attribute name="value">
        <xsl:value-of select="rdf:Description/si:query" />
    </xsl:attribute>
    </input>

can be simplified to

<input type="hidden" name="query"
     value="{rdf:Description/si:query}" />

It's called an attribute value template.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Thanks a lot Michael

my input and output is as follows:

input


<rdf:Description rdf:nodeID="adsd">
<si:query><![CDATA[?s <http://mitsmit.rdf.in/2007/01/ind#kw> "rudi studer".]]></si:query>

<si:outlink rdf:resource="http://xmlns.com/foaf/0.1/knows"/>
<si:outlink rdf:resource="http://www.w3.org/2000/01/rdf-schema#seeAlso"/>
<si:outlink rdf:resource="http://xmlns.com/foaf/0.1/phone"/>
<si:outlink rdf:resource="http://xmlns.com/foaf/0.1/homepage"/>
<si:inlink rdf:resource="http://purl.org/dc/elements/1.1/creator"/>
<si:inlink rdf:resource="http://xmlns.com/foaf/0.1/knows"/>
</rdf:Description>

and the ouput is :

1 select box with outlinks only. It is not creating the second select box with all inlinks.

Thanks once again

 
Old January 31st, 2007, 07:18 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I don't think you have shown me the whole input document or the whole stylesheet - for example, the namespace declarations are missing. I can't see anything wrong in what you have shown me, so I have to conclude the problem is in what you have left out.

Also, it's helpful to describe the desired and actual output in terms of HTML source, not appearance on the browser screen. That eliminates one possible source of problems.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 3rd, 2007, 01:34 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I can't see anything wrong with your code. Please post a complete source document and stylesheet, and show the output you are getting; and tell us what XSLT processor you are using.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo box choice creating filtered combo box stevensj5 Access 11 September 13th, 2007 11:33 AM
Newbie needs help creating Select statement! Mintyman SQL Language 4 November 13th, 2006 01:11 PM
Fill select box and select recordset value markd Classic ASP Databases 1 February 20th, 2006 06:41 PM
multicolored List Box or Select Box sasidhar79 Javascript 1 February 15th, 2005 01:47 AM
select box/List box alphabetic sort sasidhar79 Javascript How-To 3 November 10th, 2004 03:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.