Edit 01 Feb 2012
One idea is to make things expandable. Here is a first attempt.
\tikzset{my style/.style = {minimum width = 2cm,inner xsep=3cm}}
\def\pgfkeysmarkkey#1{%
\expandafter\def\csname pgfkeysvaluefromstyle@ii@#1\endcsname
##1,##2#1##3=##4,##5\pgfeov{##4}}
\def\pgfkeysvaluefromstyle#1{%
\expandafter\expandafter\expandafter\pgfkeysvaluefromstyle@i
\csname pgfk@/tikz/#1/.@cmd\endcsname\pgfeov}
\def\pgfkeysvaluefromstyle@i\pgfkeysalso#1#2{%
\csname pgfkeysvaluefromstyle@ii@#2\endcsname,#1,\pgfeov}
\pgfkeysmarkkey{minimum width}
\pgfkeysvaluefromstyle{my style}{minimum width}
Some comments. When defining a style, the .style handler defines a macro \pgfk@<long path to the key>/.@cmd where <long path to the key> is /tikz/my style for a style defined by \tikzset{my style/.style = ...}.
This macro takes one argument delimited by \pgfeov. In this macro, the whole definition of the style is stored as an argument given to \pgfkeysalso. So if one defines my style with \tikzset{my style/.style = {minimum width = 2cm, inner xsep = 3cm}}, the macro \pgfk@/tikz/my style/.@cmd (called with \pgfk@/tikz/my style/.@cmd<arg>\pgfeov where <arg> is a possibly empty argument) will expand to \pgfkeysalso{minimum width = 2cm, inner xsep = 3cm}.
The idea is to get rid of \pgfkeysalso to get the key = val list of the style and the parse the key = val list to get the value we are looking for.
To make it expandable, I do not see another solution than to "mark" the key we are looking for.
So here is the working example.
\documentclass{article}
\usepackage{tikz}
\usepackage[explicit]{titlesec}
\makeatletter
\def\pgfkeysmarkkey#1{%
\expandafter\def\csname pgfkeysvaluefromstyle@ii@#1\endcsname
##1,##2#1##3=##4,##5\pgfeov{##4}}
\def\pgfkeysvaluefromstyle#1{%
\expandafter\expandafter\expandafter\pgfkeysvaluefromstyle@i
\csname pgfk@/tikz/#1/.@cmd\endcsname\pgfeov}
\def\pgfkeysvaluefromstyle@i\pgfkeysalso#1#2{%
\csname pgfkeysvaluefromstyle@ii@#2\endcsname,#1,\pgfeov}
\makeatother
\tikzset{mystyle/.style={outer xsep=10pt, outer ysep=10pt}}
\pgfkeysmarkkey{outer ysep}
\titlespacing*{\section}{\pgfkeysvaluefromstyle{mystyle}{outer ysep}}{0pt}{0pt}
\begin{document}
\section{Section}
\end{document}
Here is what I suggest (I choose to work with minimal width rather than outer xsep but I hope it is clear it is the same). It may not be the best approach but, right now, I do not have any other ideas.
The idea is to use the key handler .forward to so that any call to mystyle will trigger the key /tikz/save my style minimum width that will exec two things:
- set (locally to the group) the key
/tikz/my style minimum width to the value of minimum width defined with the style mystyle.
- set (globally) the macro
\mystyleminimumwidthvalue so that it expands to the value of minimum width defined with the style mystyle.
When the style is used once say, in a \draw command, the options are set locally so it is not possible to access the value saved outside of the \draw command (see last \node in the first tikzpicture in the example below). (Note that the trick with \edef\x is required because for some reason \pgfmathparse, called by the key minimum width, does not like \pgfkeysvalueof as an argument [I may be wrong here]).

\documentclass{standalone}
\usepackage{tikz}
\tikzset{%
mystyle/.style = {%
minimum width = 2cm},
mystyle/.forward to = /tikz/save my style minimum width,
save my style minimum width/.code = {%
\pgfkeyssetvalue{/tikz/my style minimum width}{%
\pgfkeysvalueof{/pgf/minimum width}}%
\xdef\mystyleminimumwidthvalue{%
\pgfkeysvalueof{/pgf/minimum width}}},
my style minimum width/.initial = \pgfkeysvalueof{/pgf/minimum width}}
\begin{document}
\begin{tikzpicture}
\node[draw,mystyle] at (0,0) {\pgfkeysvalueof{/pgf/minimum width}};
\node[draw,red,minimum width = 5cm] at (2,0)
{\pgfkeysvalueof{/pgf/minimum width}};
\begingroup
\edef\x{%
\endgroup
\noexpand\node[draw,blue,minimum width = \pgfkeysvalueof{/tikz/my style
minimum width}] at (4,0) {\pgfkeysvalueof{/tikz/my style
minimum width}};}
\x
\end{tikzpicture}
\begin{tikzpicture}[mystyle]
\begingroup
\edef\x{%
\endgroup
\noexpand\node[draw,blue,minimum width = \pgfkeysvalueof{/tikz/my style
minimum width}] at (4,0) {\pgfkeysvalueof{/tikz/my style
minimum width}};}
\x
\end{tikzpicture}
\end{document}
\pgfkeysusevalue? I'm sure I've seen something like that… – Seamus Feb 1 '12 at 13:19