|
Hi all,
I've got a small problem while designing a web-page. I am using a stylesheet .css to customize the appearance of my page. The stylesheet looks as follows:
.rightbar<br />
{<br />
background-color: #d2691e;<br />
color:whitesmoke;<br />
}<br />
.body <br />
{<br />
background-color: #d2691e;<br />
color:whitesmoke;<br />
font-family:Arial;<br />
font-style:italic;<br />
font-weight:200;<br />
}<br />
.body img <br />
{<br />
src:"Images/Chocolates/1.jpg";<br />
alt:"007";<br />
}<br />
.footer<br />
{<br />
background-color: #d2691e;<br />
color:whitesmoke;<br />
}
In my web page which is of type .ASPX, i've used the above stylesheet. All stuff is working fine except the ".body img" customization above. I've got a element which is given the class attribute as "body".
As the tag is right inside this element, so i think this customization should work. but its not working. The portion of HTML using this class is as follows:
<td class="body" style="width: 616px; text-align: left;"><br />
<br /><br />
<img id="img1" alt="1" src="" style="height: 177px; width: 442px;" align="middle"/> <br />
<br /><br />
<asp:contentplaceholder id="FlowerPicture" runat="server"><br />
</asp:contentplaceholder><br />
</td>
could you plz help me with this ?
when you want something, the universe conspires in helping you achieve it
|
|
|
|
|
prahlad1981 wrote: .body img
{
src:"Images/Chocolates/1.jpg";
alt:"007";
}
"src" an "alt" are not CSS1 or CSS2 properties.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi George,
Thanks very much for your reply. I figured out that in ASP.Net there are better ways to change images on runtime (based on user preferences) than using stylesheets. However, the .Net XML Intellisense editor does show a property called src, but it works only for fonts and not for the img tag.
when you want something, the universe conspires in helping you achieve it
|
|
|
|
|
The "img" tag has "src" and "alt" attributes. That is what the intellisense is picking up. Also, ASP.NET 2.0 works well with CSS.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi,
My application has a class CUser which represents a user. The application serializes the user object to XML like this:
CUser aUser = new CUser("firstname", "surname", "address");
XmlSerializer serializer = new XmlSerializer(typeof(CUser));
StreamWriter streamWriter = new StreamWriter("user.xml");
serializer.Serialize(streamWriter, aUser);
streamWriter.Close();
I've been asked to have the user details encrypted so people can't casually look at the user details. From the above I'd like to encrypt the XML strings as they're written to the file but is there an easy way of doing it? It seems that it would be convenient to have the data encrypted by the StreamWriter and then decrypted by a StreamReader . I'll need a password so how do I manage that within the application?
Thanks
|
|
|
|
|
Hello. I'm newbie in working with xml files. I need to load a xml file to a datatable. First thing I saw is the dataset.ReadXml method, but I get an exception:
The same table (mSCAddress) cannot be the child table in two nested relations.
The nesting level is quite deep, and later I have to move throw the structure to create a datatable with some relevant data.
I don't know where to start.
Regards,
Diego F.
|
|
|
|
|
I detail a bit the file structure.
<file>
<record>
<composite>
<data>...</data>
<data>...</data>
</composite>
</record>
<recurd>
<data>...</data>
</record>
</file>
As you see, inside record section I have two posibilities. I can have just one data or a composite section, that contains more than one data sections.
Inside data, there are different possibilities also.
Is that structure a problem to load the file?
Regards,
Diego F.
|
|
|
|
|
Well, as I tested, the problem is having as a nested element inside <composite> and inside <record>
I can't change the file structure. Can you tell me other way to do that?
Regards,
Diego F.
|
|
|
|
|
Below is a sampling of my stylsheel code. When it exports the information to an excel page all of the columns are the same width. How can I customize each colum entry to conform to a custom column width?
thanks for the help.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="iso-8859-1">
<xsl:template match="DESIGNLIST">
<xsl:for-each select="DESIGN">
<xsl:if test="position()=1">
<xsl:call-template name="DesignData">
<xsl:with-param name="HeaderRow" select="1">
<xsl:call-template name="DesignData">
<xsl:with-param name="HeaderRow" select="0">
<xsl:template name="DesignData">
<xsl:param name="HeaderRow">
<xsl:choose>
<xsl:when test="$HeaderRow>0"><xsl:text>item Number
<xsl:otherwise><xsl:value-of select="position()">
<xsl:if test="THUMBNAIL">
<xsl:choose>
<xsl:when test="$HeaderRow>0"><xsl:text>,Thumbnail
<xsl:otherwise><xsl:text>,<xsl:value-of select="THUMBNAIL">
<xsl:if test="NAME">
<xsl:choose>
<xsl:when test="$HeaderRow>0"><xsl:text>,Design#
<xsl:otherwise><xsl:text>,"<xsl:value-of select="NAME"><xsl:text>"
<xsl:if test="REV">
<xsl:choose>
<xsl:when test="$HeaderRow>0"><xsl:text>,Rev
<xsl:otherwise><xsl:text>,<xsl:value-of select="REV">
<xsl:if test="RESOURCE">
<xsl:for-each select="RESOURCE">
<xsl:call-template name="ResourceData">
<xsl:with-param name="HeaderRow" select="$HeaderRow">
|
|
|
|
|
I suggest you turn off the html parsing when you post the code because it's simply disappeared.
|
|
|
|
|
I want to create a XSL file, that can merge two XML file.
The first XML file is of
<Root>
<ECV>
<ECID>0100</ECID>
<Type>LIST</Type>
<Size>32</Size>
<Name>SNSPOL</Name>
<Desc>Set sensor attribute setting</Desc>
<Variable ID="1">
<SubVal>
<Type>INT</Type>
<Size>1</Size>
<Name>SNSPOL1</Name>
<Val>0</Val>
</SubVal>
<SubVal>
<Type>INT</Type>
<Size>1</Size>
<Name>SNSPOL2</Name>
<Val>0</Val>
</SubVal>
<SubVal>
<Type>INT</Type>
<Size>1</Size>
<Name>SNSPOL3</Name>
<Val>0</Val>
</SubVal>
</SubVal>
</Variable>
</ECV>
</Root>
The Second one is of the format
<Root>
<ECV>
<EcsID>109</EcsID>
<OrgID>0100</OrgID>
<Type>3</Type>
<Size>32</Size>
<Name>SNSPOL</Name>
<Description>Set sensor attribute setting</Description>
<Variable ID="1">
<SubVar>
<EcsID>109</EcsID>
<Type>7</Type>
<Size>1</Size>
<Name>SNSPOL</Name>
</SubVar>
</Variable>
</ECV>
<Root>
I want to add the <EcsId> from the second XML file to the first XML file.
I tried in this way.
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" />
<!-- load the merge file -->
<xsl:variable name="ecvs" select="document('ECV_M121.xml')" />
<xsl:template match="/">
<Root>
<xsl:for-each select="Root/ECV">
<!-- cache the employee's ID -->
<xsl:variable name="name">
<xsl:value-of select="./Name" />
</xsl:variable>
<!-- copy the child nodes -->
<ECV>
<xsl:copy-of select="$ecvs/Root/ECV[Name=$name]/EcsID" />
<!-- copy the children of the matching employee node from the merge file -->
<xsl:copy-of select="child::*" />
</ECV>
</xsl:for-each>
</Root>
</xsl:stylesheet>
I was able to add the EcsId in the first level. But for the second level not able to do.
Since I have never written any XSLT programming I need some of your hint.
Regards
Anil
|
|
|
|
|
Hi,
I'm loading an XML file generated by SQL Server 2005 and trying to locate certain nodes:
Dim d As New Xml.XmlDocument
d.Load(path)
If I use the following:
Dim lst As Xml.XmlNodeList = d.SelectNodes("//COLUMN")
then "lst" contains 0 nodes,
If I use this one instead:
Dim lst As Xml.XmlNodeList = d.GetElementsByTagName("COLUMN")
then "lst" is correctly filled.
Am I missing something important on XPath, XML...????
Or is it a VB.Net issue?
I don't think it's a .Net problem, because that very same code works on other xml files (with different tags).
|
|
|
|
|
Hi all,
I'm fairly new to xsl so please bare with me if this is a trivial issue.
I'm getting my XML from a database so it's just a string of row nodes with nodes representing the values of the row within.
Mostly it is one row per page. However, sometimes it is more, maximum 4 rows per page.
Each row node has a child node rowsequence which states what number row on the page the row should be.
So far I have been able to get to the beginning of each sequence of row nodes as follows:
<xsl:for-each select="ROWDATA/ROW">
<xsl:if test='BLOCKSEQUENCE=1'>
<xsl:call-template name="page"/>
</xsl:if>
</xsl:for-each>
However, I am not sure what to do next. How, to iterate over the following nodes that are supposed to be on the same page. all I can see is the logic should be: starting from the first node in the sequence keep iterating forward until you find a row node whose rowsequence node has a value of 1.
If anyone show me how to write this into XSL it would greatly appreciated.
Thank you for any help
PS
I'm using XSL 2.0 (Saxon 8)
Cheers
Tom
Philosophy: The art of never getting beyond the concept of life.
Religion: Morality taking credit for the work of luck.
|
|
|
|
|
Please post some sample XML data and the desired XSLT output so that I can help you better.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi, thanks for the interest.
Here's a chunk of the XML, simplified so as not to consume too much space. As you can see there should be 3 pages of output. Whenever the BLOCKSEQUENCE value returns to 1 a new page started. Therefore, there should be three tables on three pages. The first table should have three rows. The second should have two rows and the third should have one row. I am at a loss as to how to iterate over this XML in such a way as how to do this.
<?xml version="1.0" ?>
<ROWDATA>
<ROW>
<TABLE_ROW_DETAILS>XSL-FO to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>1</BLOCKSEQUENCE>
</ROW>
<TABLE_ROW_DETAILS>to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>2</BLOCKSEQUENCE>
</ROW>
<ROW>
<TABLE_ROW_DETAILS>to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>3</BLOCKSEQUENCE>
</ROW>
<TABLE_ROW_DETAILS>to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>1</BLOCKSEQUENCE>
</ROW>
<ROW>
<TABLE_ROW_DETAILS>to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>2</BLOCKSEQUENCE>
</ROW>
<TABLE_ROW_DETAILS>to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>1</BLOCKSEQUENCE>
</ROW>
</ROWDATA>
My XSL so far is as follows
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master margin-right="0.8cm" margin-left="0.8cm" margin-bottom="0.8cm" margin-top="0.8cm" page-width="29.7cm" page-height="21cm" master-name="A4-landscape">
<fo:region-body margin-bottom="1.5cm" margin-top="1.5cm"/>
<fo:region-before extent="1.5cm"/>
<fo:region-after extent="1.0cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<xsl:for-each select="ROWDATA/ROW">
<xsl:if test='BLOCKSEQUENCE=1'>
<xsl:call-template name="page"/>
</xsl:if>
</xsl:for-each>
</fo:root>
</xsl:template>
<xsl:template name="page">
<fo:page-sequence master-reference="A4-landscape">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:table text-align="left" table-layout="fixed" width="100%">
<fo:table-column column-width="0.19cm"/>
<fo:table-column column-width="1.80cm"/>
<fo:table-column column-width="4.00cm"/>
<fo:table-column column-width="2.7cm"/>
<fo:table-column column-width="3.10cm"/>
<fo:table-column column-width="2.80cm"/>
<fo:table-column column-width="0.2cm"/>
<fo:table-column column-width="1.70cm"/>
<fo:table-column column-width="1.10cm"/>
<fo:table-column column-width="0.2cm"/>
<fo:table-column column-width="0.02cm"/>
<fo:table-column column-width="0.9cm"/>
<fo:table-column column-width="0.01cm"/>
<fo:table-column column-width="2.4cm"/>
<fo:table-column column-width="3.7cm"/>
<fo:table-column column-width="0.9cm"/>
<fo:table-column column-width="2.4cm"/>
<fo:table-body>
<xsl:call-template name="pageHeader"/>
//Here is my problem. I don't know how to call the pageBlock template the appropriate number of times.
<xsl:call-template name="pageBlock"/>
<xsl:call-template name="pageFooter"/>
</fo:table-body>
</fo:table>
</fo:block>
</fo:flow>
</fo:page-sequence>
</xsl:template>
Cheers
Tom
Philosophy: The art of never getting beyond the concept of life.
Religion: Morality taking credit for the work of luck.
|
|
|
|
|
Your XML was not valid so I used the following:
<?xml version="1.0" ?>
<ROWDATA>
<ROW>
<TABLE_ROW_DETAILS>XSL-FO to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>1</BLOCKSEQUENCE>
</ROW>
<ROW>
<TABLE_ROW_DETAILS>to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>2</BLOCKSEQUENCE>
</ROW>
<ROW>
<TABLE_ROW_DETAILS>to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>3</BLOCKSEQUENCE>
</ROW>
<ROW>
<TABLE_ROW_DETAILS>to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>1</BLOCKSEQUENCE>
</ROW>
<ROW>
<TABLE_ROW_DETAILS>to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>2</BLOCKSEQUENCE>
</ROW>
<ROW>
<TABLE_ROW_DETAILS>to describe the row of a table</TABLE_ROW_DETAILS>
<BLOCKSEQUENCE>1</BLOCKSEQUENCE>
</ROW>
</ROWDATA>
For illustration, I transformed this XML to HTML into 3 sets of tables. The key to the
transformation is to get the first following sibling of ROW "following-sibling::ROW[1]" and the "blocksequence" parameter that stops the recursion when BLOCKSEQUENCE does not equal it.
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="ROWDATA/ROW[BLOCKSEQUENCE = 1]" mode="page"/>
</body>
</html>
</xsl:template>
<xsl:template match="ROW" mode="page">
<table class="page">
<xsl:apply-templates select="." mode="row">
<xsl:with-param name="blocksequence" select="1"/>
</xsl:apply-templates>
</table>
</xsl:template>
<xsl:template match="ROW" mode="row">
<xsl:param name="blocksequence"/>
<xsl:if test="$blocksequence = BLOCKSEQUENCE">
<tr>
<td><xsl:value-of select="BLOCKSEQUENCE"/><xsl:text>: </xsl:text></td>
<td><xsl:value-of select="TABLE_ROW_DETAILS"/></td>
</tr>
<xsl:apply-templates select="following-sibling::ROW[1]" mode="row">
<xsl:with-param name="blocksequence" select="$blocksequence + 1"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Output:
<html>
<body>
<table class="page">
<tr>
<td>1: </td>
<td>XSL-FO to describe the row of a table</td>
</tr>
<tr>
<td>2: </td>
<td>to describe the row of a table</td>
</tr>
<tr>
<td>3: </td>
<td>to describe the row of a table</td>
</tr>
</table>
<table class="page">
<tr>
<td>1: </td>
<td>to describe the row of a table</td>
</tr>
<tr>
<td>2: </td>
<td>to describe the row of a table</td>
</tr>
</table>
<table class="page">
<tr>
<td>1: </td>
<td>to describe the row of a table</td>
</tr>
</table>
</body>
</html>
"We make a living by what we get, we make a life by what we give." --Winston Churchill
-- modified at 16:27 Monday 17th September, 2007
|
|
|
|
|
Thanks George
Cheers
Tom
Philosophy: The art of never getting beyond the concept of life.
Religion: Morality taking credit for the work of luck.
"The object of life is not to be on the side of the majority, but to escape finding oneself in the ranks of the insane."
- Marcus Aurelius
|
|
|
|
|
Hello All,
I am having issues trying to convert XML to HTML using C#. I have done this before using simple style sheets and simple xml documents.
I now have to do this on a larger scale.
The current issue is that I get an XsltException stating 'matches()' is an unknown XSLT function. This exception is thrown on the xslCompiledTransform.transfrom call.
Is this a standard function? If so how do I use it?
If anyone can help me with this I would greatly appreciate it.
My code snippet.
String outputFile = outputFileTextBox.Text;
XmlUrlResolver resolver = new XmlUrlResolver();
XslCompiledTransform tran = new XslCompiledTransform(true);
tran.Load(new XPathDocument(xsltFileTextBox.Text), XsltSettings.Default, resolver);
tran.Transform(xmlInTextBox.Text, outputFile);
Thanks in advance for all the help.
Phillippio
|
|
|
|
|
|
George,
Thank you very much for this information. It is very helpful.
Have you every used either of these 2 with c#?
Thanks Again
Phillippio
|
|
|
|
|
Actually, I only use C# when I have too. I do most of my programming in C++/CLI, and I have used both in C++/CLI.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hello,
VS 2005
I am using a dataset to write to an xml file using the following
dim dsIncidents as new Dataset()
dsIncidents.WriteXML(xmlIncidentFile, XmlWriteMode.DiffGram)
I use a different dataset to read the xml file
dim dsReadIncidents as new Dataset()
dsReadIncidents(xmlIncidentFile,XmlReadMode.DiffGram) 'When I check the number of tables, there is zero.
However, if I do the following without using the DiffGram it works ok, and I can read the xml file and display the table.
dsIncidents.WriteXML(xmlIncidentFile)
dsReadIncidents(xmlIncidentFile)
Now it will read in the xml file. But I need to read in the DiffGram as I need to track changes to the dataset.
Can anyone tell me what could be the problem in reading and writing using the DiffGram.
Many thanks for any suggestions,
Steve
|
|
|
|
|
Hello Friends ,
I am new in xml , i want use xml as database like sqlserver. how can i
fire insert ,update ,delete command for xml database .
Manu
|
|
|
|
|
Hi,
I am creating an in-memory xml file using XMLDOM.
Does this xml file need to be formatted with CRLFs so that each node is on a new line or does the file as a single line with all the nodes make a difference?
The file has been formatted properly, with begin and end tags but the fact it is saved as one line make a difference?
I feel that it should not make a difference as long as all the tags are set up properly.
For example:
With breaks:
<person>
<lname></lname>
<fname></fname>
<address>/address>
</person>
Without breaks
<person><lname></lname><fname></fname><address>/address></person>
Many thanks.
|
|
|
|
|
Either format is okay! However, the format without breaks loads and parses faster, saves disk space, and possibly some memory. By the way, if you want to make your XML file even smaller, use attributes wherever possible.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|