FP2003, applying XML formatting rules, unencoded ampersands in URL

T

Tristan K.

Hello all,

My co-workers and I use FrontPage 2003 to make pages that validate as XHTML
1.0 Transitional. We use Design View mostly, then right before publishing go
to Code view and Apply XML Formatting Rules. This works wonderfully, except
it unencodes ampersands in all our URLs (it changes every instance of "&" to
"&" if it exists in an "<a> </a>" element). Is there a way to stop this from
happening? If not, is there something fancy we can do with FP2003's
search-and-replace function so as to globally replace only those instances of
"&" with "&amp;" that exist within "<a> </a>" elements?

Thanks in advance for any help.
 
S

Stefan B Rusynko

1) Provide a snippet of a & link before / after the change
2) You can use FP 2003 S & R the Html Tags tab - Html Rules for the type of replace you want




| Hello all,
|
| My co-workers and I use FrontPage 2003 to make pages that validate as XHTML
| 1.0 Transitional. We use Design View mostly, then right before publishing go
| to Code view and Apply XML Formatting Rules. This works wonderfully, except
| it unencodes ampersands in all our URLs (it changes every instance of "&" to
| "&" if it exists in an "<a> </a>" element). Is there a way to stop this from
| happening? If not, is there something fancy we can do with FP2003's
| search-and-replace function so as to globally replace only those instances of
| "&" with "&amp;" that exist within "<a> </a>" elements?
|
| Thanks in advance for any help.
|
|
 
T

Tristan K.

1)
Before applying XML formatting rules (code view):
<code>
<!-- before -->
<a href="http://www.test.com/index.htm?one=1&two=2">test</a>
can't
<!-- end before -->
</code>

After applying XML formatting rules (code view):
<code>
<!-- after -->
<a href="http://www.test.com/index.htm?one=1&two=2">test</a>
can't
<!-- end after -->
</code>

I'm happy that the apostrophe changes to <code>'</code> in the word "can't,"
but I not happy about how applying xml formatting rules changes my encoded
ampersand in the href attribute to an unencoded one.

2) I've struggled with the HTML Rules in the S & R function, but I just
can't seem to get it to work. It seems I can replace the contents of an
element, and I can change the element itself, and I can change an element's
attribute, but I can't change the content of an element's attribute. Or am I
missing something?

Does anyone have a clever macro that uses regexp to accomplish something
akin to what I'm after? The thread at
http://dbforums.com/showthread.php?threadid=429652 indicates a similar need,
just not in a FrontPage environment.
 
S

Stefan B Rusynko

I don't see what you mean by "changes my encoded ampersand in the href attribute to an unencoded one"
Both your before & after code lines look identical w/ an unencoded &
<a href="http://www.test.com/index.htm?one=1&two=2">test</a>

If I enter
<a href="http://www.test.com/index.htm?one=1&amp;two=2">test</a>
It does reformat it to
<a href="http://www.test.com/index.htm?one=1&two=2">test</a>

No you are not missing anything in the S&R (you are limited to the options in the drop down)




| 1)
| Before applying XML formatting rules (code view):
| <code>
| <!-- before -->
| <a href="http://www.test.com/index.htm?one=1&two=2">test</a>
| can't
| <!-- end before -->
| </code>
|
| After applying XML formatting rules (code view):
| <code>
| <!-- after -->
| <a href="http://www.test.com/index.htm?one=1&two=2">test</a>
| can't
| <!-- end after -->
| </code>
|
| I'm happy that the apostrophe changes to <code>'</code> in the word "can't,"
| but I not happy about how applying xml formatting rules changes my encoded
| ampersand in the href attribute to an unencoded one.
|
| 2) I've struggled with the HTML Rules in the S & R function, but I just
| can't seem to get it to work. It seems I can replace the contents of an
| element, and I can change the element itself, and I can change an element's
| attribute, but I can't change the content of an element's attribute. Or am I
| missing something?
|
| Does anyone have a clever macro that uses regexp to accomplish something
| akin to what I'm after? The thread at
| http://dbforums.com/showthread.php?threadid=429652 indicates a similar need,
| just not in a FrontPage environment.
|
|
| "Stefan B Rusynko" wrote:
|
| > 1) Provide a snippet of a & link before / after the change
| > 2) You can use FP 2003 S & R the Html Tags tab - Html Rules for the type of replace you want
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > | Hello all,
| > |
| > | My co-workers and I use FrontPage 2003 to make pages that validate as XHTML
| > | 1.0 Transitional. We use Design View mostly, then right before publishing go
| > | to Code view and Apply XML Formatting Rules. This works wonderfully, except
| > | it unencodes ampersands in all our URLs (it changes every instance of "&" to
| > | "&" if it exists in an "<a> </a>" element). Is there a way to stop this from
| > | happening? If not, is there something fancy we can do with FP2003's
| > | search-and-replace function so as to globally replace only those instances of
| > | "&" with "&" that exist within "<a> </a>" elements?
| > |
| > | Thanks in advance for any help.
| > |
| > |
| >
| >
| >
 
T

Tristan K.

Yes, sorry. I was trying to have my "before" ampersand display as the entity
you would see if you removed the spaces from "& a m p ;".


-----------
If I enter
<a href="http://www.test.com/index.htm?one=1&two=2">test</a>
It does reformat it to
<a href="http://www.test.com/index.htm?one=1&two=2">test</a>
--------

Yes, but I don't want it to. I want it to preserve the "& a m p ;" (minus
spaces) in the querystring. I'm fooling around with HTML Tidy, which fixes
this, but it seems overkill.

Thanks for putting up with my inabilitiy to get my ampersands displayed
correctly.




Stefan B Rusynko said:
I don't see what you mean by "changes my encoded ampersand in the href attribute to an unencoded one"
Both your before & after code lines look identical w/ an unencoded &
<a href="http://www.test.com/index.htm?one=1&two=2">test</a>

If I enter
<a href="http://www.test.com/index.htm?one=1&two=2">test</a>
It does reformat it to
<a href="http://www.test.com/index.htm?one=1&two=2">test</a>

No you are not missing anything in the S&R (you are limited to the options in the drop down)




| 1)
| Before applying XML formatting rules (code view):
| <code>
| <!-- before -->
| <a href="http://www.test.com/index.htm?one=1&two=2">test</a>
| can't
| <!-- end before -->
| </code>
|
| After applying XML formatting rules (code view):
| <code>
| <!-- after -->
| <a href="http://www.test.com/index.htm?one=1&two=2">test</a>
| can't
| <!-- end after -->
| </code>
|
| I'm happy that the apostrophe changes to <code>'</code> in the word "can't,"
| but I not happy about how applying xml formatting rules changes my encoded
| ampersand in the href attribute to an unencoded one.
|
| 2) I've struggled with the HTML Rules in the S & R function, but I just
| can't seem to get it to work. It seems I can replace the contents of an
| element, and I can change the element itself, and I can change an element's
| attribute, but I can't change the content of an element's attribute. Or am I
| missing something?
|
| Does anyone have a clever macro that uses regexp to accomplish something
| akin to what I'm after? The thread at
| http://dbforums.com/showthread.php?threadid=429652 indicates a similar need,
| just not in a FrontPage environment.
|
|
| "Stefan B Rusynko" wrote:
|
| > 1) Provide a snippet of a & link before / after the change
| > 2) You can use FP 2003 S & R the Html Tags tab - Html Rules for the type of replace you want
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > | Hello all,
| > |
| > | My co-workers and I use FrontPage 2003 to make pages that validate as XHTML
| > | 1.0 Transitional. We use Design View mostly, then right before publishing go
| > | to Code view and Apply XML Formatting Rules. This works wonderfully, except
| > | it unencodes ampersands in all our URLs (it changes every instance of "&" to
| > | "&" if it exists in an "<a> </a>" element). Is there a way to stop this from
| > | happening? If not, is there something fancy we can do with FP2003's
| > | search-and-replace function so as to globally replace only those instances of
| > | "&" with "&" that exist within "<a> </a>" elements?
| > |
| > | Thanks in advance for any help.
| > |
| > |
| >
| >
| >
 
Top