Hi Joe,

Sounds like you should be using an XSLT editor/tool instead of testing and
debugging directly with Ode.  The following should get you on the right
track,

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="
1.0">
    <xsl:output method="xml"/>
    <xsl:param name="key"/>
    <xsl:param name="replacement"/>

    <xsl:template match="//item" >
        <xsl:choose>
            <xsl:when test=" normalize-space(string) = $key " >
                <item>
                    <xsl:apply-templates select="string[1]"/>
                    <string><xsl:value-of select="$replacement"/></string>
                </item>
            </xsl:when>
            <xsl:otherwise>
                <xsl:copy>
                    <xsl:apply-templates select="*|@*|text()"/>
                </xsl:copy>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

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

</xsl:stylesheet>

cheers,
alex


On 9/25/07, jbi joe <[EMAIL PROTECTED]> wrote:
>
>
> Im having a tifft of a time manipulating XML in my bpel.
> I am using Netbeans 5.5 to create BPEL and it seems to
> work OK.  I have written a few XSL transformations to manipulate
> my XML that work well.  HOWEVER,  my problem is that I have
> to deal with legacy XML format that isnt friendly to XPath or XSL, I
> think.
> The schema is legacy and Im not allowed to change it.
> I have to parse througfh the XML by the FIRST string element in
> the item list and then alter the value of the next string.  For example;
> I search for cups and then get the string following it, which is coffee
> and make it tea instead.    From inside of netbeans all I see are the
> schema tags, i.e.
> local-name()=items/*local-name()=string/*local-name()=string.
> I feel like Im trying to hack out XSL or XPath to solve this.  Is there an
> easier or recommended way?  Its very hard to debug too, even though
> I have the DEBUG turned on for ODE.  ANY HELP GREATLY appreaciated.
> Here is a little snippet of what my XML appears as;
> <message>
>     <Level1> Title for level one </Level1>
>     <Level2>  Title for level two </Level2>
>     <Level3 msg=Here is a big data blob>
>         <list>
>            <item>
>                <string> cups </string>
>                <string> coffee </string>
>          </item>
>          <item>
>                <string> plates </string>
>                <string> saucer</string>
>          </item>
>         .
>         .
>         .
>        </Level3>
> </message>
> --
> View this message in context:
> http://www.nabble.com/Xpath-help-%28-or-XSL-%29-for-complex-schema-tf4515165.html#a12878329
> Sent from the Apache Ode User mailing list archive at Nabble.com.
>
>

Reply via email to