Reparsing existing XML element

Discussion in 'XML' started by timbrigham@gmail.com, Dec 13, 2005.

  1. Guest

    Forgive me if this has been asked before, but I haven't found anything
    useful in my searches.
    I have an XML document generated from an external program that I can't
    change the output format on. Most of the output is great, but one
    specific element, needs to be parsed into about a dozen smaller
    elements based on a delimiter. I'm unsure how to do this effectively.
    Any help would be much appreciated.
    , Dec 13, 2005
    #1
    1. Advertising

  2. Peter Flynn Guest

    wrote:

    > Forgive me if this has been asked before, but I haven't found anything
    > useful in my searches.
    > I have an XML document generated from an external program that I can't
    > change the output format on. Most of the output is great, but one
    > specific element, needs to be parsed into about a dozen smaller
    > elements based on a delimiter. I'm unsure how to do this effectively.
    > Any help would be much appreciated.


    What language do you need to do this in?
    In XSLT, have a look at substring-before and recursive templates.

    ///Peter
    --
    XML FAQ: http://xml.silmaril.ie/
    Peter Flynn, Dec 13, 2005
    #2
    1. Advertising

  3. Guest

    I was looking at doing it in XSLT, but open to other options.
    Thanks for the input.
    , Dec 14, 2005
    #3
  4. JAPISoft Guest

    Hello Peter,

    Your problem is that you have a text block in your XML output that
    should be transformed to XML elements ? And you need to scan each
    separator for extracting the whole data ? Is it what you mean ?

    XSLT was not really adapted to scan text values, but I think you could
    try with a named template using a parameter.

    Here a sample code :

    <xsl:template name="parsing">
    <xsl:param name="line"></xsl:param>
    <xsl:if test="$line<>''">
    <xsl:call-template name="parsing">
    <xsl:with-param name="line">
    <xsl:value-of select="substring-after( $line, 'YOUR_SEP' )"/>
    </xsl:with-param>
    </xsl:call-template>
    </xsl:if>
    </xsl:template>


    Best regards,

    A.Brillant
    EditiX - XML Editor and XSLT Debugger
    http://www.editix.com

    Peter Flynn wrote:
    > wrote:
    >
    >
    >>Forgive me if this has been asked before, but I haven't found anything
    >>useful in my searches.
    >>I have an XML document generated from an external program that I can't
    >>change the output format on. Most of the output is great, but one
    >>specific element, needs to be parsed into about a dozen smaller
    >>elements based on a delimiter. I'm unsure how to do this effectively.
    >>Any help would be much appreciated.

    >
    >
    > What language do you need to do this in?
    > In XSLT, have a look at substring-before and recursive templates.
    >
    > ///Peter
    JAPISoft, Dec 15, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    573
  2. nrm
    Replies:
    3
    Views:
    525
  3. Jean-Marc Vanel
    Replies:
    0
    Views:
    1,466
    Jean-Marc Vanel
    Jun 24, 2003
  4. HANM
    Replies:
    2
    Views:
    706
    Joseph Kesselman
    Jan 29, 2008
  5. dc
    Replies:
    1
    Views:
    92
    Chris Carter
    Feb 3, 2007
Loading...

Share This Page