www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  WebPublisher PRO    xsl and multiple entries
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Posted
Hello, I am using a xsl file to display my results, however, in the fields that have multiple entries only the first entry is displayed, does anyone has run into the same problem?
Jean Pierre
 
Posts: 166 | Location: Lima, Peru | Registered: Thu July 05 2001Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
To display multiple entries you will have to use a for each xsl statement:

<xsl:for-each select="inm:Field">
<xsl:value select="."/>
</xsl:for-each>

instead of <xsl:value-of select="inm:Field"/>
 
Posts: 10 | Registered: Wed May 26 2004Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
I had the same problem, I tried

<xsl:for-each select="inm:Field">
<xsl:value select="."/>
</xsl:for-each>

but my multiple entries are getting strung together. My original field has e.g.:

- Smith, Mel
- Jones, Griff

From my XML I'm getting:
<inm:Field>Smith, Mel</inm:Field>
<inm:Field>Jones, Griff</inm:Field>

But from the above XSL, I get:
<mytag>Smith, MelJones, Griff</mytag>

But I want:
<my tag>Smith, Mel
Jones, Griff</mytag>

Any ideas or similar experience - I've looked near and far but am left high and dry (sigh...)
Thanks for your help
Brent
 
Posts: 21 | Location: Wellington, New Zealand | Registered: Tue July 29 2003Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
I'm not an XSL expert, but below is an XSL file (for use with the sample CARS textbase) that converts WebPublisher PRO XML output to (somewhat ugly) HTML output. It does display all the entries (for example, in the Colors field). Perhaps you could extract the information you need from it.

You may also want to try looking at the .XSL file created by using the Save As button next to the Use Default XSL Transform button in DB/TextWorks. Choose File>Import, select any file name (since you're not really going to import it), select the XML option on the File Format tab, then click the Save As button. This XSL converts XML to Inmagic Tagged Format, but I'm guessing you can extract the information you need from it.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:inm="http://www.inmagic.com/webpublisher/query"
version="1.0">
<xsl:output method="html"/>

<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>Cars Search</TITLE>

<script language="JavaScript">
function parseQuery(strQuery)
{
strQuery = unescape(strQuery);
arrQuery = strQuery.split('&');
strQuery = arrQuery.join("<br />");
return strQuery;
}
</script>
<style>
.label { color:navy;
font-weight: bold
}
</style>
</HEAD>
<BODY>

<table width="95%">
<xsl:apply-templates select="/inm:Results/inm:Recordset/inm:Record">
</xsl:apply-templates>

<xsl:apply-templates select="/inm:Results/inm:Recordset/inm:Error">
</xsl:apply-templates>
</table>

</BODY>
</HTML>
</xsl:template>


<xsl:template match="Record">

<tr>
<td>
<xsl:apply-templates select="inm:Name"/>
</td>
<td>
<xsl:apply-templates select="inm:Product-Number"/>
</td>
<td>
<xsl:apply-templates select="inm:Type"/>
</td>
<td>
<xsl:apply-templates select="inm:Colors"/>

</td>
<td>
<xsl:apply-templates select="inm:Status"/>
</td>
<td>
<xsl:apply-templates select="inm:Club-Price"/>
</td>
</tr>
</xsl:template>

<xsl:template match="inm:Name">
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="inm:Product-Number">
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="inm:Type">
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="inm:Colors">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()"><br /></xsl:if>
</xsl:template>

<xsl:template match="inm:Status">
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="inm:Club-Price">
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="Error">
<tr>
<td colspan="2">
<H2 style="color:red"><xsl:value-of select="."/></H2>
</td>
</tr>
<tr>
<td><span style="font-weight:bold;font-style: italic">Information for Support Personnel:</span>
<br/><span class="label">Product: </span><xsl:value-of select="/Recordset/@ProductTitle"/>
<br/><span class="label">Version: </span><xsl:value-of select="/Recordset/@ProductVersion"/>
</td>
</tr>
<xsl:apply-templates select="Results/Recordset/Extra"/>


<xsl:apply-templates select="Results/Recordset/Query">
</xsl:apply-templates>
</xsl:template>

<xsl:template match="Extra ">
<tr>
<td colspan="2">
<H3 style="background-color:red;color:white"><xsl:value-of select="."/></H3>
</td>
</tr>
</xsl:template>

<xsl:template match="Query ">
<tr>
<td colspan = "2">
<span class="label">Web Publisher Query:</span><xsl:value-of select="."/>
</td>
</tr>
<tr>
<td colspan = "2">
<span class="label">Individual Parameters:</span>
<br/>
<script language="JavaScript">
document.write(parseQuery('<xsl:value-of select="."/>'));
</script>
</td>
</tr>
</xsl:template>

</xsl:stylesheet>
 
Posts: 217 | Registered: Wed June 29 2005Reply With QuoteEdit or Delete MessageReport This Post
ray
Posted Hide Post
If you want to separate multiple entries you will have to add something there to do it yourself, as XSLT will not do it for you; for example, if you wanted HTML output you could do something like
<xsl:for-each select="inm:Field">
<p><xsl:value select="."/></p>
</xsl:for-each>  


Ray Chow
Government of Ontario
 
Posts: 29 | Location: Toronto, ON, Canada | Registered: Mon March 05 2001Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  WebPublisher PRO    xsl and multiple entries