By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,402 Members | 1,679 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,402 IT Pros & Developers. It's quick & easy.

Can someone tell if Sitemap always require a starting root?

P: n/a
Can someone tell if Sitemap always require a starting root? Can it have
more than one root? I am having a problem trying to hide a root node
without hiding its children using a Treeview component. I know you can
do that if you use sitempadatasource. But instead I am forced to use
this tranformation:

xForm.Transform(m_TblMgr.XmlDoc, xslArgs, tmpS)

where tmpS is the sitemap output.

Thank you

Rod

Aug 30 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
In article <11**********************@h48g2000cwc.googlegroups .com>,
rl********@gmail.com writes
>Can someone tell if Sitemap always require a starting root?
Yes
Can it have
more than one root?
No
>I am having a problem trying to hide a root node
without hiding its children using a Treeview component. I know you can
do that if you use sitempadatasource.
So why not do that then?
But instead I am forced to use
this tranformation:

xForm.Transform(m_TblMgr.XmlDoc, xslArgs, tmpS)

where tmpS is the sitemap output.

Thank you

Rod
--
Alan Silver
(anything added below this line is nothing to do with me)
Sep 5 '06 #2

P: n/a
Thanks Alan. I don't like my solution. I think having to run second
transformation on a large tree with over 2000 items again would affect
performance. It would be better do it right from the beginning don't
you think? Look what I did:
Removing "Categories from Root Node"

// TRANSFORM ROOT NODE TO REMOVE "CATEGORIES"
//load the Xml doc
XslTransform myXslTrans = new XslTransform();
//load the Xsl

myXslTrans.Load(CommonLogic.SafeMapPath("EntityHel per/RemoveRootNode.xslt"));
//create the output stream
StringWriter tmpS2 = new StringWriter();
//do the actual transform of Xml
myXslTrans.Transform(doc, null, tmpS2);

string s = tmpS2.ToString();
s = s.Replace("{","");
s = s.Replace("}","");
s = s.Replace(General.RegexSearch(s, @"<\?xml(.*?)>",
0), "");
s = "<siteMap>"+ s + "</siteMap>";
tmpS2.Close();
Removing "Categories from Root Node"

// TRANSFORM ROOT NODE TO REMOVE "CATEGORIES"
//load the Xml doc
XslTransform myXslTrans = new XslTransform();
//load the Xsl

myXslTrans.Load(CommonLogic.SafeMapPath("EntityHel per/RemoveRootNode.xslt"));
//create the output stream
StringWriter tmpS2 = new StringWriter();
//do the actual transform of Xml
myXslTrans.Transform(doc, null, tmpS2);

string s = tmpS2.ToString();
s = s.Replace("{","");
s = s.Replace("}","");
s = s.Replace(General.RegexSearch(s, @"<\?xml(.*?)>",
0), "");
s = "<siteMap>"+ s + "</siteMap>";
tmpS2.Close();
Rod

Alan Silver wrote:
In article <11**********************@h48g2000cwc.googlegroups .com>,
rl********@gmail.com writes
Can someone tell if Sitemap always require a starting root?

Yes
Can it have
more than one root?

No
I am having a problem trying to hide a root node
without hiding its children using a Treeview component. I know you can
do that if you use sitempadatasource.

So why not do that then?
But instead I am forced to use
this tranformation:

xForm.Transform(m_TblMgr.XmlDoc, xslArgs, tmpS)

where tmpS is the sitemap output.

Thank you

Rod

--
Alan Silver
(anything added below this line is nothing to do with me)
Sep 5 '06 #3

P: n/a
In article <11**********************@e3g2000cwe.googlegroups. com>,
rl********@gmail.com writes
>Thanks Alan. I don't like my solution. I think having to run second
transformation on a large tree with over 2000 items again would affect
performance. It would be better do it right from the beginning don't
you think? Look what I did:
<snip>

This looks very complex for a site map. How often do you do this? Does
your site map change that often?

Why not just write the site map out to a file whenever it changes. That
will give you the advantage of only needing to run the code whenever
changes occur, not whenever you want to get the data, plus it allows you
to use the sitemapprovider, which will give you the extra functionality
you want.

HTH

--
Alan Silver
(anything added below this line is nothing to do with me)
Sep 5 '06 #4

P: n/a
I forgot to post piece RemoveRootNode.XSLT.
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="siteMapNode">
<xsl:copy-of select="child::node()" />
</xsl:template>
</xsl:stylesheet>

This looks very complex for a site map. How often do you do this? Does
your site map change that often?

We do change a lot. Our cateogories change every week and we tend to
add and remove frequently.

Why not just write the site map out to a file whenever it changes.
I can't touch the DLL file that generate the nodes it. Yeah I know that
the provider has a property for the starting node where you can specify
the starting point of the tree. But using the provider would still
require mapping it to the Treview Datasource and may be a little bit
slower and work similarly in the same way of a second transform.

Rod

That
will give you the advantage of only needing to run the code whenever
changes occur, not whenever you want to get the data, plus it allows you
to use the sitemapprovider, which will give you the extra functionality
you want.

HTH

--
Alan Silver
(anything added below this line is nothing to do with me)
Sep 5 '06 #5

P: n/a
Alan, I forgot to ask if the fact that the siteMap necessarly needs a
single root not is part of its schema constrain ? I've seen XML with
more than one root. Why is this way if Microsoft want to use for
multiple purposes binding controls, not only for creating site maps? It
doen't make sense? Unless they want it to be used only for Hierarchical
"Site Maps"

Rod

Sep 5 '06 #6

P: n/a
In article <11**********************@m73g2000cwd.googlegroups .com>,
rl********@gmail.com writes
>Alan, I forgot to ask if the fact that the siteMap necessarly needs a
single root not is part of its schema constrain ? I've seen XML with
more than one root.
I don't think XML requires a single root node, but then I'm not expert,
but sitemap files certainly do.
Why is this way if Microsoft want to use for
multiple purposes binding controls, not only for creating site maps? It
doen't make sense? Unless they want it to be used only for Hierarchical
"Site Maps"
Well, it *is* called a "site map" and they obviously feel that a site
map always has one root node, ie the home page. Logical really.

--
Alan Silver
(anything added below this line is nothing to do with me)
Sep 5 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.