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 November 23rd, 2006, 08:27 AM
Authorized User
 
Join Date: Dec 2005
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ramesh.kumarm
Default

Well, yes - i thought so.


Lemme try with the options i do have....and if any issues...i'll again touble you.

thanx a lot!

 
Old November 24th, 2006, 07:29 AM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Ramesh

         I also have same problum, could u pls gide me???

 
Old November 24th, 2006, 07:30 AM
Authorized User
 
Join Date: Dec 2005
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ramesh.kumarm
Default

rasa,
Itz beyond the invisible.
I'm lookin' for something NEW...
will update ya soon!

 
Old November 24th, 2006, 08:05 AM
Authorized User
 
Join Date: Dec 2005
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ramesh.kumarm
Default

Rasa,
I hope this could be done with 2 transformations.
The firstone with a default value for the Number.
And the second would rather take a count of the number and replace it with the actual count. Do you have any go on this?

 
Old November 24th, 2006, 09:44 AM
Authorized User
 
Join Date: Dec 2005
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ramesh.kumarm
Default

--------------------------------
CRAWLING in MY skin
these WOUNDS they WILL not HEAL
FEAR is HOW i FALL
CONFUSING what IS real!
--------------------------------

Well Rasa,
Try this as per ur specs/reqs - This eventually turned the lights ON....

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:template name="OrderItemNumberReplace">
        <xsl:param name="outputString"/>
        <xsl:param name="target"/>
        <xsl:param name="replacement"/>

        <xsl:choose>
            <xsl:when test="contains($outputString,$target)">
                <xsl:value-of select="concat(substring-before($outputString,$target),$replacement)"/>
                <xsl:call-template name="OrderItemNumberReplace">
                    <xsl:with-param name="outputString" select="substring-after($outputString,$target)"/>
                    <xsl:with-param name="target" select="$target"/>
                    <xsl:with-param name="replacement" select="$replacement"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$outputString"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template match="//*/*/OrderItem/OrderItemNumber/text()">
            <xsl:variable name="pos">
                <xsl:number count="OrderItem" level="any" format="1"/>
            </xsl:variable>
            <xsl:call-template name="OrderItemNumberReplace">
                <xsl:with-param name="outputString" select="//*/*/OrderItem/OrderItemNumber/text()"/>
                <xsl:with-param name="target" select="'COUNTERREPLACE'"/>
                <xsl:with-param name="replacement" select="$pos"/>
            </xsl:call-template>
    </xsl:template>

    <xsl:template match="@*|*">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

</xsl:stylesheet>

Ramesh
"Always Look For Something NEW"
 
Old November 29th, 2006, 05:39 AM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks a lot ramesh ..

 
Old December 1st, 2006, 06:27 AM
Authorized User
 
Join Date: Dec 2005
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ramesh.kumarm
Default

;) good luck!

Ramesh
"Always Look For Something NEW"





Similar Threads
Thread Thread Starter Forum Replies Last Post
output xsl in predefined template newuser2525 XSLT 1 December 24th, 2007 08:30 AM
xsl:template problem mickhughes XSLT 1 August 16th, 2007 08:40 AM
xsl:template match 'overlapping' ? Kabe XSLT 1 February 25th, 2005 06:03 AM
xsl template concat problem nambati XSLT 5 January 31st, 2005 03:43 PM
help with xsl template match enT XSLT 9 September 24th, 2003 06:21 AM





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