473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Manipulating a variable in XSLT

Hi,

I am trying to manipulate a XSLT variable. Manipulating is replacing the string value in it.

My XML file looks like:
<root>
<item name="PageTitle">
<value>Screen Page<value/>
</item>
<item name="PageHeader">
<value>&lt;cmroot id="jsample_screenpage"&gt;
&lt;cattributes&gt;
&lt;cmnode id="hair" type="string" hasParseData="true"&gt;black&lt;/cmnode&gt;
&lt;cmnode id="color" type="string" hasParseData="true"&gt;wheat&lt;/cmnode&gt;
&lt;/cattributes&gt;
&lt;/cmroot&gt;</value>
</item>
</root>


Could any one help me to replace the &lt; and &gt; with < and >

or

Help me to read the value of "id" and the cmnode value black and wheat from the xml file tru XSLT.

Regards,
GoguL
Sep 14 '07 #1
4 2709
jkmyoung
2,057 Expert 2GB
Does disable-output-escaping work for you?
<xsl:value-of select="value" disable-output-escaping="yes">
Sep 14 '07 #2
Thanks for replying.

Yes it works for me, I am able to get all those to a variable. Could you help to find how to parse the variable and get the replicant values.
Sep 17 '07 #3
Hi Young,

Not sure whether my previous message is clear. So explaining again. After using that disable-output-escaping="yes" I am taking those data to an XSL-Variable. So the variable var has following data:

<cmroot id="jsample_screenpage"> <cattributes> <cmnode id="hair" type="string" hasParseData="true">black</cmnode> <cmnode id="color" type="string" hasParseData="true">wheat</cmnode> </cattributes> </cmroot>

Now I need to take the value of all cmnode id value and the data of cmnode. The problem I am facing is not able to retrive the replicant data from the variable.

If you could clarify this, that would be great.
Sep 17 '07 #4
jkmyoung
2,057 Expert 2GB
Normally, if you were passed that string as xml, you could run an apply-templates on it, and have a template for cmnode. eg:
Expand|Select|Wrap|Line Numbers
  1. <xsl:template match="cmnode">
  2.   <xsl:value-of select="@id">,<xsl:value-of select="text()"/>
  3. </xsl:template>
You probably need a node-set function, eg

<xsl:apply-templates select="exsl:node-set($var)" xmlns:exsl="http://exslt.org/common"/>
Sep 17 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Frederik Sørensen | last post by:
I include a xslt stylesheet with variables for all the error messages in my system. <xsl:variable name="Banner_error_1"> errormessage 1 for banner </xsl:variable> <xsl:variable...
1
by: ms_chika | last post by:
Please help! I just want to know how can i pass the return value of a javascript function to a xsl variable. I have an xsl file and from that file i will call a javascript function then the...
2
by: Jon Martin Solaas | last post by:
Hi, I have a general document somewhat like this: -------------------------------------- <root> <level1> <level2> <interestingstuff number="2"/> <interestingstuff number="3"/>...
4
by: Cathie | last post by:
Hi All, I am trying to get my style sheet to work. It works fine in IE but I can't get it to work in .net. Below is the function I use for transforming, where advancedOptionsFile is the path...
2
by: Darrel | last post by:
I have a control that transforms an XML file using XSLT. I also want to grab a particular variable out of the XML file. I thought an easy way to do this would be no have the XSLT just find the...
6
by: Jody Gelowitz | last post by:
I have run into an issue with variable scope within an XSLT document that is translated in VS.NET 2.0. Under VS.NET 1.1 (XslTransform), this code works fine. However, when using VS.NET 2.0...
2
by: 张韡武 | last post by:
We have preffered language set as variable in xslt: <xsl:variable name="preferred_language"> zh </xsl:variable> Data: <name xml:lang="de">Raw Materials (Mining incl.)</name> <name...
4
by: Jean-François Michaud | last post by:
Hello, I've been looking at this for a bit now and I don't see what's wrong with the code. Can anybody see a problem with this? Here is an XSLT snippet I use. <xsl:template match="graphic">...
8
by: Hoi Wong | last post by:
With the XSLT 1.0 engine that I was forced to use, I have to parse old XML scripts where the number (to be parsed and saved into $EPISODE_NUMBER_RAW) that I want to parse is written with a comma...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.