XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 22nd, 2003, 01:21 PM
Sm00ve Sm00ve is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 78 Sm00ve User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
xslt with html embedded in the xml doc

I am having a problem with XSLT and I was hoping that you could shed some light on it.

I have a line of text I am referencing in a XML document...
Code:
<Text>Remove existing sheet metal at a width of <input_text/> coping and store for reuse.</Text>


I have been able to find this node via a template AND I can identify the input_text tag as well. What I want to do is replace the input_text tag with a real HTML tag. I am doing this like so...

Find/output the substring before the tag.
Then, output the html input element in place of the tag.
And finally, output the substring after the tag.

The xslt code in question.
Code:
<xsl:value-of select="substring-before(text(), '<')"/>
<xsl:apply-templates select="input_text"/><BR/>     
<xsl:value-of select="substring-after(text(), '>')"/>

The above template defined.
Code:
<xsl:template match="input_text">
<input type="text" name="input_text_'+@id"/>
</xsl:template>

I looked at the xpath functions and I know I can't use the < or > brackets, I tried escaping the brackets < and > but it isn't associating the tag bracets with the codes.

My above code will NOT output any of the substrings. It does output a textbox though.

Am I trying to do something that xslt can't do? Any help would be greatly appreciated.

Thank you for your time.

Last edited by Sm00ve : October 22nd, 2003 at 01:25 PM.

Reply With Quote
  #2  
Old October 22nd, 2003, 01:38 PM
imbrokn imbrokn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: NJ
Posts: 428 imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 34 m 8 sec
Reputation Power: 10
Send a message via AIM to imbrokn
Try this:
Code:
<xsl:template match="input_text">
<input type="text" >
<xsl:attribute name="name">
  input_text_<xsl:value-of select="@id"/>
</xsl:attribute>
</input>
</xsl:template>

Last edited by imbrokn : October 22nd, 2003 at 01:51 PM.

Reply With Quote
  #3  
Old October 22nd, 2003, 01:39 PM
imbrokn imbrokn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: NJ
Posts: 428 imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 34 m 8 sec
Reputation Power: 10
Send a message via AIM to imbrokn
also in regards to your brackets try this
PHP Code:
<xsl:text disable-output-escaping="yes">
<![
CDATA[
  <
b>put html code in here</b>
that should be fine. ]]> 
</
xsl:text

Last edited by imbrokn : October 22nd, 2003 at 01:45 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > xslt with html embedded in the xml doc


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway