substitution of sting help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manugm1987
    New Member
    • May 2009
    • 13

    substitution of sting help

    Code:
    span.cls_002{ font-family:Arial,serif;font-size:22px;color:rgb(51,51,51);font-weight:bold;font-style:normal}
    div.cls_002{font-family:Arial,serif;font-size:22px;color:rgb(51,51,51);font-weight:bold;font-style:normal}
    span.cls_004{font-family:Arial,serif;font-size:12px;color:rgb(51,51,51);font-weight:normal;font-style:normal}
    div.cls_004{font-family:Arial,serif;font-size:12px;color:rgb(51,51,51);font-weight:normal;font-style:normal}
    span.cls_003{font-family:Arial,serif;font-size:9px;color:rgb(51,51,51);font-weight:normal;font-style:normal}
    Code:
    <div style="position:absolute;left:38.20px;top:144.02px" class="cls_004">
    <div style="position:absolute;left:38.20px;top:144.02px" class="cls_003">
    <div style="position:absolute;left:38.20px;top:144.02px" class="cls_005">
    I need an asp script such that the data within flower brace i.e font-family:Arial,se rif;font-size:22px;color :rgb(51,51,51); font-weight:bold;fon t-style:normal, gets replaced in place of class="cls_003" , "cls_004". For cls_003 the data within braces of span.cls_003 should get replaced, similarly cls_004 shld be replaced with span.cls_004... ... so on.

    The data within span.cls_003{---some data-------} , span.cls_004{---------} may change i.e {---some data---} may change from 1 file to other. The asp script should replace with correct data as in span.cls_003 or span.cls_004 in place of cls_003 or cls_004 even the data within braces changes .

    Finally the div tag should look like this:
    Code:
    <div style="position:absolute;left:38.20px;top:144.02px" class="font-family:Arial,serif;font-size:22px;color:rgb(51,51,51);font-weight:bold;font-style:normal">
    Thank U
    Last edited by Frinavale; May 8 '09, 01:27 PM. Reason: Added code tags. Please post code between [code] [/code] tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    I'm glad that you want to do this...

    You're going to have a few problems though because the class attribute of HTML elements should contain the name of a CSS class that contains the style for the element. It should not contain any CSS.

    So, the HTML mark up that you are looking to achieve is invalid:
    Code:
    <div 
      style="position:absolute;left:38.20px;top:144.02px" 
      class="font-family:Arial,serif;font-size:22px;color:rgb(51,51,51);font-weight:bold;font-style:normal"
    >
    It should be:
    Code:
    <div 
      style="position:absolute;left:38.20px;top:144.02px" 
      class="cls_002"
    >
    Because the class attribute of the div is expecting the name of the class(es) that contain the style for the div and "cls_002" is the class name for the div's style.

    I do not understand your problem so I can't help you any further.
    You have outlined what you "want" to do but haven't actually told us what you've tried or why you want to do this....all I know is that you are trying to achieve something that will ultimately not work in the end.

    -Frinny

    Comment

    • manugm1987
      New Member
      • May 2009
      • 13

      #3
      thx for ur reply .....
      Actually i wont be using it as html rather i will be saving it as xml and use xslt to display the data.
      Wat u told is correct with html, but in case of xml the class attribute of div wont be taking any values from user defined classes i.e span.cls_002{-------}. In case of html it automatically takes the value.
      So i need an asp script so tat i can dynamically insert class attribute values i.e class="cls_003" this shld be like class="value defined in the class span.cls_002 or 003"

      Pls help. This is the final part of our BE final year project.
      We are four members in a team . I dont know anything about asp.net , one of my team member knows it , but he is not so much talented to do this , so can u pls provide some idea about how to go thru ,

      Or tell me how to modify xml such tat it automatically takes user defined class values i.e value in span.cls_002 or div.cls_002 in place of class="cls_003" .....

      Thank u

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Manugm,

        I'm sorry but I still don't understand what you are trying to do.

        Please provide me with the exact details of what you are doing.

        Looking at your code, you are defining CSS classes that should be applied to HTML elements.

        Are you dynamically creating the CSS classes and HTML elements based on values stored in an xml file? What xslt are you using to create these elements?

        Are you having a problem with dynamically creating the CSS and HTML based on your xml file?


        Or are you having another problem?
        What is the problem?
        What is the cause of the problem?
        What have you tried so far to solve the problem?

        Comment

        • manugm1987
          New Member
          • May 2009
          • 13

          #5
          just provide me an asp script such tat class="cls_002" gets replaced with an value in span.cls_002{--------}
          i.e after applying asp script my xml should look like this
          <div style="------" class="font-family:Arial,se rif;font-size:22px;color :rgb(51,51,51); font-weight:bold;fon t-style:normal">

          this font-family:Arial,se rif;font-size:22px;color :rgb(51,51,51); font-weight:bold;fon t-style:norma" will be varying .... so class attribute shld take the value correctly i.e wat ever the value is defined the class attribute shld take tat value.

          Dont worry about html ... i wont be using it has html

          Thank u

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            Open the file with a StreamReader and read it into a string. Then parse it?

            Comment

            Working...