• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to add a literal string div tag to my output?

 
Ranch Hand
Posts: 624
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following template:



Which quite correctly creates an attribute in the current element called 'longdescription' and has a concatenated string of all sorts of stuff..

What I need to do is to wrap those sections in <div> tags within the output so I get:

<elementname longdescription="<div id='inclusions>Inclusion details goes here</div><div id='description'>Description detail goes here</div>"/>

So far I've had limited success!! - any ideas??


This doesnt work 'cos the validator tells me that "<DIV> cannot exist in this part of the styesheet"....

I've experimented with CDATA tags and xsl:text tags but I either have the validator telling me I cant put div tags there - or the tags get encoded to :
&lt; div &gt;

[ October 15, 2007: Message edited by: Adrian Wanwierd ]
[ October 15, 2007: Message edited by: Adrian Wanwierd ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand you correctly, you are trying to put markup < and > characters inside an attribute - I believe this is illegal which is why you will have to use the encoded forms.

Time for rethinking your document structure perhaps?

Bill
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, of course the tags get encoded when you put them in attributes. That's because you can't have markup inside an attribute value.

As Bill says, time to rethink your document structure? I don't think what you are doing there is malformed XML but I don't think it's a good idea to put markup into attribute values either. Next thing we know you're going to be back here asking why your whitespace is disappearing from those attribute values.
 
Alan Wanwierd
Ranch Hand
Posts: 624
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I absolutely agree the xml structure is insane...

but thats the deal with IBM Websphere Commerce!!! - The xml format for data to be loaded has EVERYTHING as attributes..... An element for each table you wish to populate and an attribute for each column in that table...

madness....

Thanks for your input guys!
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There you go, then. And writing < as &lt; is called escaping, not encoding. So don't sweat the escaping, that's supposed to happen. When you get the data out of the XML -- or out of the database -- you'll find it's really in its unescaped form.
 
reply
    Bookmark Topic Watch Topic
  • New Topic