Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Need help with printing out all nodes with this xml

From: "Neil Smith [MVP Digital Media]" <neil@------.--->
To: NULL
Date: 6/24/2009 10:39:00 AM
On Wed, 24 Jun 2009 00:47:04 -0700 (PDT), naijacoder
<lurowam@g...> wrote:

>I have my xml below and i'm trying to print out all the values in the
>multi-service node.
>But when i do
><xsl:value-of select="multi-service/multi-mobile/."/>
>I can only get the first value in the first postion.
>How can i get all the values e.g
>0411777777
>0411888888
>I know my for each is matching the plan node but how can i break out


Well, the code you posted *cannot* match the plan node :
<xsl:for-each select="/report/report_info/detail/plan">

There is no 'detail' node in your XML document at any level (and not
below report_info node). 

So this possibly implies you are hitting the default text template
provided by your XSL processor - which would output all the text nodes
of the document, run together into a mess of text.

That doesn't sound exactly what you described though.

As you have extracted only a part of your XSL stylesheet, we cannot be
certain, but my guess is you have another template which is matching
the content multi-mobile and it's confusing the result (it's not the
template you think is matching, which is the non-effective
xsl:for-each above) 



PS it's not necessary (required) to use the trailing dot in 
<xsl:value-of select="multi-service/multi-mobile/."/>

You could as easily use this in your example document
<xsl:value-of select="multi-service/multi-mobile"/>
as multi-mobile node has no child nodes, but only text.

HTH
Cheers - Neil

>and match the multi-service nodes.
>Thanks in Advance
>
>See Below:
>--------------------------
>
><report>
>  <report_info>
><plan>
>        <plan-code>BSHM0099BNAA01  </plan-code>
>        <plan-desc>Shared Bus Cap $99 24 Mth     </plan-desc>
>        <ban>422222265                                         </ban>
>        <finance-amount>0</finance-amount>
>        <finance-duration></finance-duration>
>        <connection-type>Vodafone MultiServ New        </connection-
>type>
>        <multi-service>
>          <multi-connect-type>New</multi-connect-type>
>          <multi-handset-code>NOHANDSET       </multi-handset-code>
>          <multi-handset-desc>No Handset - Service Only GSM </multi-
>handset-desc>
>          <multi-handset-serial>TESTNOK1            </multi-handset-
>serial>
>          <multi-
>mobile>0411777777                                        </multi-
>mobile>
>          <multi-simcard>SIMCARDCJPOST   </multi-simcard>
>          <multi-simserial>TESTCJ1             </multi-simserial>
>        </multi-service>
>        <multi-service>
>          <multi-connect-type>Port</multi-connect-type>
>          <multi-handset-code>NOHANDSET       </multi-handset-code>
>          <multi-handset-desc>No Handset - Service Only GSM </multi-
>handset-desc>
>          <multi-handset-serial>TESTCJ1             </multi-handset-
>serial>
>          <multi-
>mobile>0411888888                                        </multi-
>mobile>
>          <multi-simcard>SIMCARDCJPOST   </multi-simcard>
>          <multi-simserial>TESTCJ2             </multi-simserial>
>        </multi-service>
>      </plan>
>  </report_info>
></report>
>
>
><xsl:for-each select="/report/report_info/detail/plan">
>
>						<table class="tabledetails" cellspacing="0" style="table-
>layout:fixed" border="0" width="645px">
>
>							<tr>
>								<td width="50px"></td>
>								<td>
>									<xsl:if test="normalize-space(.)">
>										<b><xsl:value-of select="plan-desc"/>
>									</b>
>									</xsl:if>
>								</td>
></tr>
><tr>
>								<td width="50px"></td>
>								<td>
>									<xsl:value-of select="multi-service/multi-mobile/."/>
>									<xsl:value-of select="multi-service/multi-handset-code/."/>
>								</td>
>							</tr>
></table>
------------------------------------------------
Digital Media MVP : 2004-2009
http://mvp.support.microsoft.com/mvpfaqs


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent