string-replace match="Date/text()" replace="Title/text()" not doing what I would have thought.. why?

Hi,

I'm just playing with an example of from a great tutorial by Roger Costello
and James Garriss using Calabash and getting a result I don't understand.

Given this xproc:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:c="http://www.w3.org/ns/xproc-step"
                name="myPipeline">

    <p:input port="source">
        <p:document href="BookStore.xml"/>
    </p:input>

    <p:output port="result" />

    <p:for-each>
        <p:iteration-source select="//Book" />
        <p:string-replace match="Date/text()" replace="Title/text()" />
    </p:for-each>
    <p:wrap-sequence wrapper="BookStore" />

</p:declare-step>


And this XML:

<?xml version="1.0"?>
<BookStore>
    <Book>
        <Title>My Life and Times</Title>
        <Author>Paul McCartney</Author>
        <Date>1998</Date>
        <ISBN>1-56592-235-2</ISBN>
        <Publisher>McMillin Publishing</Publisher>
    </Book>
    <Book>
        <Title>Illusions The Adventures of a Reluctant Messiah</Title>
        <Author>Richard Bach</Author>
        <Date>1977</Date>
        <ISBN>0-440-34319-4</ISBN>
        <Publisher>Dell Publishing Co.</Publisher>
    </Book>
    <Book>
        <Title>The First and Last Freedom</Title>
        <Author>J. Krishnamurti</Author>
        <Date>1954</Date>
        <ISBN>0-06-064831-7</ISBN>
        <Publisher>Harper &amp; Row</Publisher>
    </Book>
</BookStore>

I'm getting output

<BookStore>
    <Book>
        <Title>My Life and Times</Title>
        <Author>Paul McCartney</Author>
        <Date/>
        <ISBN>1-56592-235-2</ISBN>
        <Publisher>McMillin Publishing</Publisher>
    </Book>
    <Book>
        <Title>Illusions The Adventures of a Reluctant Messiah</Title>
        <Author>Richard Bach</Author>
        <Date/>
        <ISBN>0-440-34319-4</ISBN>
        <Publisher>Dell Publishing Co.</Publisher>
    </Book>
    <Book>
        <Title>The First and Last Freedom</Title>
        <Author>J. Krishnamurti</Author>
        <Date/>
        <ISBN>0-06-064831-7</ISBN>
        <Publisher>Harper &amp; Row</Publisher>
    </Book>
</BookStore>

I would have thought I would get a <Date> tag with some title text() however
I'm getting the empty <Date/> tags?

Why is that and how can I move the title text into the date element as I'm
trying to do.


Thanks Much

-- 


Alex
https://sites.google.com/a/utg.edu.gm/alex

Received on Wednesday, 11 November 2009 21:16:32 UTC