Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
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 July 28th, 2008, 07:47 AM
Authorized User
 
Join Date: Jul 2008
Location: , , .
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to print the /Period/@dateFrom

How to print the value of attribute /Period/@dateFrom where attibute(@groupType='B')

<xsl:variable name="VariantA">
    <AccessFeesGroupList>
            <xsl:call-template name="createAccessFeesPeriods"/>
    </AccessFeesGroupList>
</xsl:variable>

<xsl:template match="/">
     <xsl:for-each select="xalan:nodeset($targetTree)/AccessFeesGroupList/AccessFeesGroup">
        <xsl:value-of select="../AccessFeesGroup[@groupType='B']/Period/@dateFrom"/>

    </xsl:for-each>
</xsl:template>


<xsl:template name="createAccessFeesPeriods">
    <xsl:for-each select="Document/Invoice/InvoiceItem[@CT='A']/AggSet/Att[@Ty='TM'][generate-id() = generate-id(key('by-id', @Id)[1])]">
      <xsl:variable name="SN_Id" select="../Att[@Ty='SN']/@Id"/>
      <xsl:variable name="groupTypeValue">
          <xsl:choose>
          <xsl:when test="$SN_Id='TEL'">B</xsl:when>
          <xsl:when test="$SN_Id='*ToDo /Configuration/Groupings/BundleServices *'">BUN</xsl:when>
          <xsl:when test="$SN_Id='*ToDo /Configuration/Groupings/P1Services *'">P1</xsl:when>
          <xsl:otherwise>P2</xsl:otherwise>
      </xsl:choose>
      </xsl:variable>
      <xsl:value-of select="$groupTypeValue"/> <AccessFeesGroup groupType="$groupTypeValue">
          <Period dateFrom='20080202' dateTo='' discountValue='' invoiceLineValue='' vatValue=''/>
      </AccessFeesGroup>
    </xsl:for-each>
</xsl:template>

Expected output: 20080202
Acutal output: No output ????????
 
Old July 28th, 2008, 08:33 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Your program will produce no output if

xalan:nodeset($targetTree)/AccessFeesGroupList/AccessFeesGroup

selects no nodes.

Since you haven't shown us what's in $targetTree, we can't be expected to work out why this path expression selects nothing. Of course there might be other explanations as well.

Or perhaps $targetTree is really $VariantA? But now we're trying to debug a different program from the one you showed us. I'd rather go and play Sudoku.

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old July 28th, 2008, 10:51 PM
Authorized User
 
Join Date: Jul 2008
Location: , , .
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please find the targetTree as follows,

<xsl:variable name="targetTree">
    <AccessFeesGroupList>
            <xsl:call-template name="createAccessFeesPeriods"/>
    </AccessFeesGroupList>
</xsl:variable>
 
Old July 29th, 2008, 04:19 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

<AccessFeesGroup groupType="$groupTypeValue">

should be

<AccessFeesGroup groupType="{$groupTypeValue}">

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




Similar Threads
Thread Thread Starter Forum Replies Last Post
Celebrating the Golden Period of .NET DotnetEvangel ASP.NET 1.0 and 1.1 Basics 0 April 19th, 2008 12:28 AM
heredoc with period Kevin Tough BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 July 3rd, 2007 11:57 AM
how to fill the line with a period-sign grstad HTML Code Clinic 5 June 3rd, 2005 09:41 AM
Calculate time period dtaya Access 1 July 26th, 2003 07:26 AM
RSEnableRemoteScripting and a period at top of pag lvinsel Javascript How-To 5 July 22nd, 2003 02:31 AM





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