XML Loop Statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Angelfire
    New Member
    • Nov 2006
    • 2

    XML Loop Statement

    Hello,

    Is it possible to loop through an element and have it skip over certain characters so that it spits out only what you want? For example, inside the Picture tag I need to either strip out or skip over everthing before the http://protocol.
    I have tried searching for examples of this and fear that there may be no solution. I have also used basic find and replace in any given editor but this is tedious and only satisfies limited results.

    Thank-you all in advance,

    Andrea


    Here is a block of xml code:
    <Product Id="12x10czpend ent">
    <Code>P033OV</Code>
    <Description>12 X10 CZ PENDENT</Description>
    <Url>http://store.silverand cz.com/12x10czpendent. html</Url>
    <Thumb>&lt;im g border=0 width=62 height=70 src=http://us.st11.yimg.co m/us.st.yimg.com/I/yhst-77161201758896_ 1920_678&gt;</Thumb>
    <Picture>&lt;im g border=0 width=269 height=305 src=http://us.st11.yimg.co m/us.st.yimg.com/I/yhst-77161201758896_ 1920_3417&gt;</Picture>

    <Orderable>YE S</Orderable>
    <Taxable>YES</Taxable>
    <Pricing>
    <BasePrice>2.50 </BasePrice>
    <LocalizedBaseP rice>2.50</LocalizedBasePr ice>
    </Pricing>
    <Path>

    <ProductRef Id="pendants" Url="http://store.silverand cz.com/pendants.html"> Pendants</ProductRef>
    </Path>
    <Caption>MOD 4 PRNG PENDENT 12X10</Caption>
    <OptionLists>
    <OptionList name="Color">
    <OptionValue>Am ethyst</OptionValue>
    <OptionValue>Bl ack</OptionValue>

    <OptionValue>Ch ampagne</OptionValue>
    <OptionValue>Pe ridot</OptionValue>
    <OptionValue>Pi nk</OptionValue>
    <OptionValue>Aq ua Glass</OptionValue>
    <OptionValue>Wh ite</OptionValue>
    </OptionList>

    </OptionLists>
    </Product>
    Here is my xsl stylesheet
    <?xml version='1.0'?>
    <xsl:styleshe et xmlns:xsl="http ://www.w3.org/TR/WD-xsl">
    <xsl:template match="/">
    <html>
    <body>
    <table border="1">
    <xsl:for-each select="StoreEx port/Products/Product">
    <tr>
    <td><xsl:valu e-of select="Url"/></td>
    <td><xsl:valu e-of select="Descrip tion"/></td>
    <td><xsl:valu e-of select="Descrip tion"/></td>
    <td><xsl:valu e-of select="Picture "/></td>
    <td><xsl:valu e-of select="Path"/></td>
    <td><xsl:valu e-of select="BasePri ce"/></td>
    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
Working...