#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2005
    Posts
    44
    Rep Power
    10

    XSL parsing comma separated list


    I am using apache ant to transform a supplied xml file. I am reading in files from a provider and there is a tag called "modeRestrict" that can be set in the input xml or "modeOverride" which can be set globally via a config file.

    Basically this modeRestrict/modeOverride can have the following values: AB, CD, EF, GH, IJKLM.

    AB and CD are related and EF and GH are related. The xsl checks in the global config to see if it should use the input xml values or to override whats set in the xml with the global settings.

    So for instance in the input xml to be transformed it has:

    Code:
    <modeRestrict Value="AB, EF" />
    but in the global profile it has this:

    Code:
    modeOverride=1
    modeOverride.control=AB
    modeOverride=1 means that the xsl would override the values "AB, EF" in the input xml and set the value in the transformed xml to "AB".

    This is the easy part and I have this working. However, also in the global config file are two parameters:
    Code:
    ABlinkCD
    EFlinkGH
    If ABlinkCD is set to 1 that means that in the transformation if the value is set to AB then it should also add CD into the transformation.

    So for instance if ABlinkCD and EFlinkGH were both enabled then the input values of.....

    Code:
    <modeRestrict Value="AB, EF" />
    Would be transformed to...

    Code:
    <Modes>FF,CD,EF,GH</Modes>
    I am trying to figure out how to accomplish this in a smooth way without a million when/if/etc statements. Does this all make sense? As I am writing it I can see that it might be a bit confusing. Thanks in advance for any help or tips. If something isn't clear please let me know and I will try to provide more clarity.

    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2005
    Posts
    44
    Rep Power
    10
    Mods, you can close this question. It is a little convoluted and I am using java to resolve anyway. Thanks.

IMN logo majestic logo threadwatch logo seochat tools logo